Forum Discussion

helenvn1974's avatar
New Contributor
12 years ago

Cannot call Opendialog from C# winform


I create a winform (C#) call OpenFileDialog1.ShowDialog as below:

public void btnBrowse_Click(object sender, EventArgs e)


String[] fileNames;

OpenFileDialog dialog = new OpenFileDialog();

dialog.Filter = "Excel files (*.xls)|*.XLS";

dialog.InitialDirectory = "D:";

dialog.Title = "Select a file";

if (dialog.ShowDialog() == DialogResult.OK)


    fileNames = openFileDialog1.FileNames;



--> Then I call this form :

var obj = dotNET["AutomationTestTool"]["Form1"]["zctor"]();

var res = obj["ShowDialog"]();

TestComplete show that form, but when I click on button Browse, the winform is hang and not work. Please help me resolve it.


No RepliesBe the first to reply