|
-
March 7th, 2007, 08:15 AM
#1
Multiple instances of same form are openning at same time. How to prevent it?
Hi
I am developing a windows application in which it contains a grid. on double clicking a row on the Grid it shows all the details about that row in a new form.
If i double click the same row or other row it opens the details of respective row again in a same form.
For this i followed one logic. I take a global variable (public boolean X= false) and i am setting it true when user double clicks a row. I am resetting it in the child form. Here the value is not resetting.
What i want is Is there any mechanism or statements of code to preventing the form from openning more than one form at a time.
Please Help me.
Thanks in Advance.
Ramu Medida.
-
March 7th, 2007, 11:22 AM
#2
Re: Multiple instances of same form are openning at same time. How to prevent it?
1. Have a class level form variable
2. In the double click event handler, try something like this
Pseudocode
Code:
if ((formVariable == null) || (!formVariable.Created))
{
// create the form
}
formVariable.LoadData(.....);
formVariable.Show();
formVariable.BringToFront();
I am not sure how you are opening the form to display the row data. I think you should be able to control it the place where you create the form.
-
March 7th, 2007, 11:38 PM
#3
Re: Multiple instances of same form are openning at same time. How to prevent it?
Thank You Very Much.
It is working for me.
Once Again Thank You.
Ramu Medida.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|