If the sub method really should belong in the form class, add it to the
class.
If it should be a public method, then...
Turn the sub into a function that returns the desired caption.
Instead of a Sub, use a function in the module:
Function myfunction() as String
Return "Hello World"
End Function
Calling from Form:
label1.text = myfunction()
Or
Provide an appropriate method on your form class to update the caption.
Pass in an instance to the form to the sub, and have the sub call the
method.
Form:
Public Sub SetLabelCaption(Value as String)
label1.text = Value
End Sub
Sub:
Sub MySub(FormInstance as Form1)
...
FormInstance.SetLabelCaption ("Hello World")
End sub
Calling Sub from Form:
MySub(Me)
Or, any number of other ways. Just make sure that you provide a way to
uniquely identify the particular instance of the Form1 in question, and be
aware of potential threading issues.
Gerald
"RD" <no****@nospam.net> wrote in message
news:uQ**************@TK2MSFTNGP14.phx.gbl...
Form1 calls a sub that is public in module1.
How do you write a value to a text property from with this sub?
Eg
Module myModule
sub mysub()
'From here how do I write to the label1.text that is on the
currently open form (form1) that called this sub
end sub
end module
Thanks for any help,
Bob