Hi all,
Sorry for a newb question but this is driving me nuts. I have a form which has a button and a toolbar.
The button has code which works and deletes a record in a database:
=======================================
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If (Me.Validate() And Not (PlayersBindingSource Is Nothing)) Then
If (MsgBox("Delete?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes) Then
PlayersBindingSource.RemoveCurrent()
PlayersBindingSource.EndEdit()
End If
End If
End Sub
=======================================
I can put similar code into the toolbar button just changing the Button5_Click to the name of the toolbar button but I thought it would be better if I 'called' the already written code.
I changed the Private Sub Button5_Click etc. to Public Sub Button5_Click then in the Toolbar button click event I put 'call Sub Button5_Click()'
I get errors stating that ' argument not specified for parameter 'e' ' and can't progress.
I will be using this code in a few other forms so would like to 'call' possible.
Anyone please advise what I'm missing?
Thanks
Jack
ps. There's a reason for calling the button for the original code 'Button5', it's not lazy coding. Thanks.
Sorry for a newb question but this is driving me nuts. I have a form which has a button and a toolbar.
The button has code which works and deletes a record in a database:
=======================================
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
If (Me.Validate() And Not (PlayersBindingSource Is Nothing)) Then
If (MsgBox("Delete?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes) Then
PlayersBindingSource.RemoveCurrent()
PlayersBindingSource.EndEdit()
End If
End If
End Sub
=======================================
I can put similar code into the toolbar button just changing the Button5_Click to the name of the toolbar button but I thought it would be better if I 'called' the already written code.
I changed the Private Sub Button5_Click etc. to Public Sub Button5_Click then in the Toolbar button click event I put 'call Sub Button5_Click()'
I get errors stating that ' argument not specified for parameter 'e' ' and can't progress.
I will be using this code in a few other forms so would like to 'call' possible.
Anyone please advise what I'm missing?
Thanks
Jack
ps. There's a reason for calling the button for the original code 'Button5', it's not lazy coding. Thanks.