PC Review


Reply
Thread Tools Rate Thread

Error in openFileDialog - looking for a workaround.

 
 
Ole
Guest
Posts: n/a
 
      1st Nov 2007
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


 
Reply With Quote
 
 
 
 
Peter Foot [MVP]
Guest
Posts: n/a
 
      1st Nov 2007
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

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

"Ole" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
Ole
Guest
Posts: n/a
 
      1st Nov 2007
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


"Peter Foot [MVP]" <(E-Mail Removed)> wrote in message
news:28965E89-596F-4854-8214-(E-Mail Removed)...
> 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
>
> --
> Peter Foot
> Microsoft Device Application Development MVP
> www.peterfoot.net | www.inthehand.com
> In The Hand Ltd - .NET Solutions for Mobility
>
> "Ole" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 101 - Possible Workaround - Please Test Steve Dodson [MSFT] Spyware Announcements 4 10th May 2005 03:06 AM
OpenFileDialog error when selecting more than 1 file on a Camera =?Utf-8?B?RW5kZXI=?= Microsoft Dot NET Framework 1 8th Mar 2005 03:20 PM
Strange error after using OpenFileDialog =?Utf-8?B?UmljaGFyZCBSdWJlbg==?= Microsoft Dot NET Framework Forms 0 9th Jun 2004 02:51 PM
OpenFileDialog error - help please!!!! Sailor Foley Microsoft C# .NET 3 10th Apr 2004 09:32 PM
Known error workaround anonymous Microsoft Outlook Calendar 0 26th Jan 2004 11:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:53 AM.