HI, seen some sample code here in the forum... the "sender" variable in the method "clicking " is the button that was clicked. Try casting it to a Button. Then somehow you need to have some identifier on the button so you can really identify it. I guess you can also use the name property if you create them dynamically (not really sure though)...Buttons and TextBoxes, creating and runtime and checking which one was used?
<code>
Sub AddNyButton()
Dim btnny As New Button()
btnny.Size = New Size(100, 20)
btnny.Location = New Point(20, 50)
btnny.Text = "Click me"
btnny.Name = "btn1"
Controls.Add(btnny)
AddHandler btnny.Click, AddressOf Me.clicking 'här läggs handlern till
End Sub
Private Sub clicking(ByVal sender As System.Object, ByVal e As System.EventArgs)
msgbox("Klickad")
' ok so which button was pressed out of the possible array of buttons?
' amended by Paul
End Sub
</code>
My question is how to see what button was actually pressed? I need to carete a tabpage and put some buttons and textboxes on the runtime created tab pages. so I can not hard code anything, I must test which button was pressed, I think I'll use the TAG memeber of the buttons and Value members of the Textboxes, but who can I check which button or text box was used on the user form?
cheers and bottle of beer for the best answere! /PaulSv: Buttons and TextBoxes, creating and runtime and checking which one was used?