Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / November 2007

Tip: Looking for answers? Try searching our database.

Error in openFileDialog - looking for a workaround.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ole - 01 Nov 2007 09:53 GMT
Hi,

It seems like there is an error with the openFileDialog because it crashes
the program.
The program is build for Pocket PC 2003 running Compact Framework 2.0
The error can easily be reproduced like this:

Create a new project called "File Dialog test".
Add an additional form "Form2" to the project.
Copy the below code to Form1.cs:
namespace File_Dialog_test
{
   public partial class Form1 : Form
   {
       Form2 newForm= new Form2();
       OpenFileDialog openFileDialog1 = new OpenFileDialog();

       public Form1()
       {
           InitializeComponent();
       }

       private void Form1_Load(object sender, EventArgs e)
       {
           fileSelection();
       }

       private void fileSelection()
       {
           newForm.ShowDialog();
           openFileDialog1.ShowDialog();
       }
   }
}

Run the program and verify that the program crashes after closing the
Form2 - openfileDialog never shows up???
Any idea what to do instead??

Thanks and Best regards,
Ole
Peter Foot [MVP] - 01 Nov 2007 15:04 GMT
What exception/error message do you get when Form2 closes. If you call
OpenFileDialog.ShowDialog() first and then Form2.ShowDialog() does the error
still occur?

Peter

Signature

Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility

> Hi,
>
[quoted text clipped - 37 lines]
> Thanks and Best regards,
> Ole
Ole - 01 Nov 2007 16:40 GMT
No - there is no problem if I call OpenFileDialog before Form2 but I can't
use that as a workaround because i need some information entered in form 2
in the Open File Dialog.

There is absolutely no exception or error message shown - the program just
crashes and does even disappear in the "running programs" list ??? Only
thing is that VS2005 still think it is running and I have to "Stop Debug" to
return to editor mode. If I select "Break all" the line
"OpenFileDialog.ShowDialog()" is highlightet.

Did you try the code on your machine? (I forgot to write that Form1 should
be double clicked to activate the "Form_Load event - but I guess that is
implicit to you).

Thanks Ole

> What exception/error message do you get when Form2 closes. If you call
> OpenFileDialog.ShowDialog() first and then Form2.ShowDialog() does the
[quoted text clipped - 43 lines]
>> Thanks and Best regards,
>> Ole

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.