How to pass parameter to second form?

  • Thread starter Thread starter John Howard
  • Start date Start date
J

John Howard

I am invoking a second form and would like to pass a parameter. My code is:

Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnHelp.Click

Dim frmAdminHelp As New frmAdminHelp

frmAdminHelp.Show()

End Sub


When the second form executes, it needs to know where it was called from.
How do I do this?

TIA,

John
 
* "John Howard said:
I am invoking a second form and would like to pass a parameter. My code is:

Private Sub btnHelp_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnHelp.Click

Dim frmAdminHelp As New frmAdminHelp

Add a property to your 'frmAdminHelp' and set this property here.
 
Herfried K. Wagner said:
Add a property to your 'frmAdminHelp' and set this property here.

And you could Override the Show() method in frmAdminHelp that calls the base
class Show() method and sets the property in one step, so you can do:

frmAdminHelp.Show(Me)

Me will be a reference to the calling form (the current form)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top