Shaddow Posted January 6, 2004 Posted January 6, 2004 I'm missing something between the jump from an earlier version of VB. I use to be able to do something like this: (say I have 2 modules and 1 form, form1, and main as modules and form1 as a form. something like this use to work. (inside the main module) Form1.(whatever sub or funciton is) in the new VS in the VB.net stuff I'm not able to do this. I get something like . (inside main module) Form1.(small list with like ActiveForm) but none of my public functions from form1(the module) I think this is a brain cramp that I'm missing something very obvious. Thanks.:mad: :mad: Quote
Administrators PlausiblyDamp Posted January 6, 2004 Administrators Posted January 6, 2004 In VB.Net forms are just classes - you will need to create a valid instance of the form before you can use it. dim f as new Form1 f.Show() Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Shaddow Posted January 6, 2004 Author Posted January 6, 2004 the form is the primary start object. and is already instantiated. something like this. the form opens and on a button of the form I have a button. it calls a function from the added module (which then takes control and goes from there. What I want is a way, once in that added module to access form functions, methods and properties. all I get available is a small list that starts with something like form1.ActiveForm.something etc. there are no references to any functions even though I made them public. or am I just missing something.... Quote
*Experts* mutant Posted January 6, 2004 *Experts* Posted January 6, 2004 Modules are not the best way to go in VB.NET, classes with shared members are more fit in the .NET world. Pass the form's instance to the module's method that will do what you want. 'in your module Public Sub DoSomthing(byval f as FormType) 'do something End Sub Then when you call the method from your form, do this: DoSomething(me) Then you will be able to access the instance you passed. 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.