Click button on another form
Posted on 2008-10-25
I have added a button on another form to perform an action. I want to open that form and click the button. Here is the code to open the form but the last line gives me an error. "Reference to a non shared member requires an object reference"
The button on the other form is public.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm As New frmPersons(frmIncidentReport.TblPersonsBindingSource)
Dim result As DialogResult = frm.ShowDialog
If result = Windows.Forms.DialogResult.OK Then
frmPersons.Button2_Click(Nothing, Nothing) '<<<<< Problem>>>>>