Madz Posted May 12, 2003 Posted May 12, 2003 I am getting confused with one thing. Here in .NET forms are working as classes. for example a form frmabout is a complete class. I want to call that form from some other form object, such as in VB6 if there are 2 forms we call call each other from any other object. I want to access a method on frmabout from other form but i am unablt to do so. Frmabout is already loaded in memory in case of if i write dim frmM as new frmAbout frmM.Show frmM.xxxx it opens a new form, and calls the method if i try to call directly such as like frmAbout.Xxx it do not show my form's methods its just shows methods as like a class if i try Dim frmM as frmAbout = frmAbout.ActiveForm it raise an error Is there any way to do so ? Quote The one and only Dr. Madz eee-m@il
wyrd Posted May 12, 2003 Posted May 12, 2003 Make sure the method is public. .. and can you please get rid of that distracting signature. I think we get the idea of what your nick is without having to go blind. Quote Gamer extraordinaire. Programmer wannabe.
Guest mutant Posted May 12, 2003 Posted May 12, 2003 What Wyrd said abut the method and just keep one instance of the form available to the whole class so if you need it you dont have to create the form every time. BTW I dont see anything very distracting in his sig :) Only 3 lines of normal size font and two of them got different color :) Quote
*Gurus* divil Posted May 12, 2003 *Gurus* Posted May 12, 2003 When you first create the form, keep a reference to the instance around. You can then use it whenever you like at a later point. 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
Madz Posted May 12, 2003 Author Posted May 12, 2003 (edited) Is this good if i make a module and in module i enter this public frmM as new frmAbout and with in code i call it;s reference. Edited May 12, 2003 by Madz Quote The one and only Dr. Madz eee-m@il
*Gurus* divil Posted May 12, 2003 *Gurus* Posted May 12, 2003 That's one way to do it; a tidier method might be to use the form class itself instead of a module and declare a static (shared) variable on it to hold the instance. 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
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.