in my app, i open a Dialog, in this dialog i use the FileOpenDialog, when i click on 'Ok' or 'Cancel' in my FileOpenDialog, it automatically closes the parent dialog, with a DialogResult.Cancel???
I have overloaded the ShowDialog to accept parameters in the 'Parent' Dialog
main Code
...Calling Parent Dialog
Expand|Select|Wrap|Line Numbers
- if (GenerelSetup.ShowDialog(ref szXStatIni, ref szLogbookFile) == DialogResult.OK)
- {....}
Expand|Select|Wrap|Line Numbers
- public DialogResult ShowDialog(ref string szStatIniFileName, ref string szMachinePath)
- {
- DialogResult ret;
- this.szStatIniFileName = txtStatIni.Text = szStatIniFileName;
- this.szMachinePath = txtMachinePath.Text = szMachinePath;
- ret = this.ShowDialog();
- return ret;
- }
- private void btnBrowseStatIni_Click(object sender, EventArgs e)
- {
- openFileDialog.Filter = "X-stat ini files (*.ini)|*.ini|All files (*.*)|*.*";
- openFileDialog.FilterIndex = 1;
- openFileDialog.FileName = "x-stat.ini";
- openFileDialog.InitialDirectory = szStatIniFileName;
- openFileDialog.RestoreDirectory = true;
- if (openFileDialog.ShowDialog() == DialogResult.OK)
- {
- szStatIniFileName = openFileDialog.FileName;
- txtStatIni.Text = openFileDialog.FileName;
- }
- }
Anybody able to give me a hint in the right direction??