I have tried to put the BtnUpdateSalesperson.PerformClick many places but without success. If I click on that button, everything works perfectly
I don't care for PerformClick, a better method is to take the code in the Click event for BtnUpdateSalesperson and place the code into a procedure and then in the Click event call the procedure.
So for a conceptual example let's say the code in Work
has been moved from Button1_Click
so now, Button2 can execute that code by calling Work
.
Public Class ExampleForm
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Work()
End Sub
Private Sub Work()
MessageBox.Show("Working")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If True Then
Work()
End If
End Sub
End Class