Form1 has a function called UpdateDisplay() how can I call it from Form2 ?
Thanks for any advice.
Printable View
Form1 has a function called UpdateDisplay() how can I call it from Form2 ?
Thanks for any advice.
The one way that I know of:
Form1 needs to be a form derived from Form2 meaning Form1 needs to be in code in Form2 something like
Dim F1 as new Form1
Then, make the function public. After which, F1.FunctionName should work fine.
Aside from that, I imagine it would be possible using AddressOf, but I'm not sure how.
When form1 calls form2 have it pass itself as the Owner then form2 can use that property to access it.
VB Code:
'in form1 dim frm as New Form2() frm.Owner=Me frm.Show() 'in form2 'you have to cast to the specific form to access custom items on it DirectCast(Me.Owner,Form1).UpdateDisplay()
Why don't you just put the UpdateDisplay() function in a code module? Then you can call it from both forms.
Edneeis,
YOU solved my problem !!! Thank you so very very very much !