Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple Forms
Message
From
23/09/2003 13:23:33
 
 
To
23/09/2003 13:20:30
General information
Forum:
ASP.NET
Category:
Forms
Title:
Miscellaneous
Thread ID:
00831081
Message ID:
00831582
Views:
12
Steve,

Yep, that's what I was trying to determine with that change. Now, *why* it's happening, I don't know ... you need to track *that* down now with some debugging.

~~Bonnie

>Bonnie,
>
>It works correctly from the click event of the button with the following code:
>
> frmQuestionaires = new Questionaires();
> frmQuestionaires.Show();
>
>This is weird... For some reason, it appears as though the event for the menu item is firing twice?
>
>
>
>>Wow, that's just plain weird. OK, what happens if you do this ... instead of clicking from a menu item, put a button on a form and click on that to open it.
>>
>>~~Bonnie
>>
>>>That put me back to having 2 instances......
>>>
>>>>Try just this in your declarations:
>>>>
>>>>private Form frmQuestionaires;
>>>>
>>>>And then this in your event handler
>>>>
>>>>frmQuestionaires =  new Questionaires();
>>>>frmQuestionaires.Show();
>>>>
>>>>
>>>>~~Bonnie
>>>>
>>>>>Well that helped - kinda...
>>>>>
>>>>>I'm wasn't sure exactly what you meant, but I moved the declaration out of the event handler. I wasn't sure where to put it, so I changed it to a private member of the main form:
>>>>>
>>>>> private Form frmQuestionaires = new Questionaires();
>>>>>
>>>>>My event handler now just has:
>>>>>
>>>>> frmQuestionaires.Show();
>>>>>
>>>>>Now the problem is that I get an error on subsequent clicks of the menu item. The first time is fine, it only brings up one instance of the form.
>>>>>
>>>>>
>>>>>Thanks,
>>>>>
>>>>>Steve
>>>>>
>>>>>
>>>>>>Hi!
>>>>>>
>>>>>>You should move the declaration of the form outside the event handler, and add the activate method after the show method of the form.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform