M MDEnt Member Licensed User Longtime User Mar 13, 2011 #1 If I were to have a number of buttons spread throughout my app - across different panels for example. Is there an easy way to catch the button name that was clicked as a variable/string? Thanks to all for a great support on a great product.
If I were to have a number of buttons spread throughout my app - across different panels for example. Is there an easy way to catch the button name that was clicked as a variable/string? Thanks to all for a great support on a great product.
klaus Expert Licensed User Longtime User Apr 26, 2012 #21 In the Designer you have following properties: Name: the view name EventName: the name for the view's events. Tag: an independant property that can hold any object If you have 10 buttons called btnTest1, btnTest2 to btnTest10 you can set the EventName property to btnTest for all Buttons and set their Tag property to 1, 2, to 10. The Tag property is used to know what Button raised the event. Then in the code you need: Code: Copy Sub btnTest_Click Dim btn as Button btn = Sender Select btn.Tag Case 1 Case 2 . . Case 10 End Select End Sub You'll find an example in the SecondProgram in the Beginner's Guide. Best regards. Upvote 0
In the Designer you have following properties: Name: the view name EventName: the name for the view's events. Tag: an independant property that can hold any object If you have 10 buttons called btnTest1, btnTest2 to btnTest10 you can set the EventName property to btnTest for all Buttons and set their Tag property to 1, 2, to 10. The Tag property is used to know what Button raised the event. Then in the code you need: Code: Copy Sub btnTest_Click Dim btn as Button btn = Sender Select btn.Tag Case 1 Case 2 . . Case 10 End Select End Sub You'll find an example in the SecondProgram in the Beginner's Guide. Best regards.