sethindeed Posted February 6, 2003 Posted February 6, 2003 I haven't been able to retrieve this information when searching on the forum... My question is simple : How can I prevent my program of opening two instance of the same child form ? thx Quote What I don't know keeps me excited...
Leaders dynamic_sysop Posted February 6, 2003 Leaders Posted February 6, 2003 could you not use something like a boolean? maybe Dim FrmLoaded as Boolean then on start up the boolean = False and when you load the first instance of the child form the boolean = True , then if the boolean = true tell it not to be able to load a childform ( ie: if frmLoaded = True then exit sub , else frmChild = new form2 , frmChild.Show blabla ) Quote
*Gurus* divil Posted February 6, 2003 *Gurus* Posted February 6, 2003 My suggestion would be to expand on dynamic_sysop's suggestion by making that boolean variable a static ("shared" in vb.net) member of the form class. Then in the form's constructor you could set it to true, and check it before creating a new instance of the class. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
sethindeed Posted February 6, 2003 Author Posted February 6, 2003 There is no possibilities to seek throughtout all open forms and notice if one of them is already opened ? Something like For each frm in forms blabla ? Quote What I don't know keeps me excited...
wyrd Posted February 7, 2003 Posted February 7, 2003 Well, there is with a MDI form, but I don't think there is with a regular application aside from using System.Diagnostics.Process.GetProcessesByName() and GetProcessById() methods. Quote Gamer extraordinaire. Programmer wannabe.
*Experts* Nerseus Posted February 7, 2003 *Experts* Posted February 7, 2003 The Forms collection from VB6 is no longer available. As wyrd mentioned, an MDI form knows about it's children, but looping through them all is not the .NET way - I'd go with divil's and dynamic_sysop's suggestions. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
sethindeed Posted February 7, 2003 Author Posted February 7, 2003 OK then I will use this method Thanx guys Quote What I don't know keeps me excited...
Leaders dynamic_sysop Posted February 7, 2003 Leaders Posted February 7, 2003 i always like the blabla explanation lol. the boolean has been a god send in vb6 for me so i carried it over and have used it for various instances in .net already. anyway glad to have finally been of assistance to someone on here instead of me asking a question. Quote
EliCat Posted February 11, 2003 Posted February 11, 2003 My collegue and I were looking into a similar problem and he ran across this online: http://archive.devx.com/dotnet/discussions/043002/accesscontrols.asp Maybe you can get some tips from it as well. BTW lovely signature dynamic_sysop .. congrats. :) Quote
Leaders dynamic_sysop Posted February 12, 2003 Leaders Posted February 12, 2003 ty elicat :) , quite ironic really, cuz i run a chat room and met my wife through chat, her nickname was "cat" and i'm originally from holland not uk ( almelo to be precise ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.