Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

Posted

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....

  • *Experts*
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...