1

I am developing a windows application in XP machine.in my one form i have one text box for showing the selected file with path from openfiledialog box.and the other control is button to call the openfiledialog box.

When I cliked on the button to call the open dialog box i am getting the follwing error

Throwing error on button clicking to open the OpenFileDialog

rest of the form contains another controls like data grid and dropdowns.

Please help me to resolve this issue

Thanx in advance.

Regards, Sudarshan

Update

Here is my code on button click

        OpenFileDialog  openfiledialog = new OpenFileDialog();
        openfiledialog.Filter = "xml files|*.xml";
        openfiledialog.Multiselect = false;
        DialogResult dr;
        dr = openfiledialog.ShowDialog();

        if (dr == DialogResult.OK)
        {
            txtgrdDataFile.Text = openfiledialog.FileName.ToString();
        }
Sudarshan
  • 51
  • 1
  • 4
  • Can you post some code related to dialog and how are you opening it? – Haris Hasan May 17 '11 at 06:16
  • Could you please provide your button click event's code? – fardjad May 17 '11 at 06:18
  • What is the exact exception and where it is thrown when you debug your app? – Haris Hasan May 17 '11 at 06:34
  • This exception I got whenever I run the Application. I am not getting any exception if i run the application through the code in debug mode. – Sudarshan May 17 '11 at 06:39
  • @Harris: If I run the application through double clicking on exe then I got this exception. – Sudarshan May 17 '11 at 06:41
  • I have checked your code snippet and its working fine. Could you please add more detail to your problem? – FIre Panda May 17 '11 at 06:45
  • Are you sure it is an XP machine? The stacktrace shows CreateVistaDialog()... – Edwin de Koning May 17 '11 at 06:50
  • Yes, 2 things stand out: 1) The exception notes a reference to Vista 2) The exception notes ComInterOp Looks like you may have your project's references screwed up. Any chance you tried to import a VB6 project? – jwalkerjr May 17 '11 at 07:09
  • Exception is not about ur code.How you create your project? – Saleh May 17 '11 at 08:15
  • @LightWing : Project is simply created by visual studio IDE.Nothing added extra refrences in the project – Sudarshan May 17 '11 at 08:47
  • @Abdul : Thanks for checking my code.I also checked into another program it is working fine.but in my current application if i put the same code on any form it thrown the same error. – Sudarshan May 17 '11 at 08:49
  • @Rewinder :Yes It is an XP machine only – Sudarshan May 17 '11 at 08:49
  • @Abdul : This is the only code I have on my button event.The functionality of the form is whenever form is.I have one ground information form.after loading the form it shows all the record of the of the ground the browse button is provided for selecting xml file related to ground information.Ones I clicked on browse button it thrown the above error.If I run this application through my code .the above executed perfectly. – Sudarshan May 17 '11 at 09:04

0 Answers0