Hi, everybody
I am learning how to program Excel using VB .NET and am still very much a newbie.
I am trying to understand how we can use the "sender" parameter in a click event.
I got this interesting sample from the net:
Unfortunately, the article does not explain what code to put in the click events of Button1 and Button2Code:Private Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs) _ Handles Button1.OnClick, Button2.OnClick Dim s As String If sender Is Button1 Then s = "button1" ElseIf sender Is Button2 Then s = "button2" End If MsgBox("You pressed: " & s) End Sub
I tried the following (for Button1), but it does not work:
Code:Private Sub Button1_OnClick(ByVal sender As System.Object, _ ByVal control As AddinExpress.MSO.IRibbonControl, _ ByVal pressed As System.Boolean) Handles Button1.OnClick Button_Click(Button1) '// DOES NOT WORK!! End Sub
The error message is:
Can anybody help?Argument not specified for parameter 'e' of Private Sub Button_Click (sender As Object, e As System.Event Args).
Thanks
Leon




Reply With Quote
