Easy Visual Basic help?
We have two links named button1 as well as button2
I want to compose one subroutine showing the textual content on each and every button while either of the button can be clicked.
Private Sub ButtonClick(ByVal sender Seeing that System.Item, ByVal e As Program.EventArgs) Mug handles button1.Click on, button2.click
‘ will there be any code that i can invest here to find out which from the two links were clicked
‘ msgbox ( show text to the button that has been clicked)
conclude sub
I hope I’ve made the problem clear.
Thanks
Use this sender subject to remove information from the clicked control key by assigning your sender object with a button datatype variable in order to expose the particular buttons qualities via of which variable.
Gray myBtn since Buton
myBtn = Sender
now you can read the name of the clicked button using the name home
msgbox(mtBtn.Name.toString) will certainly display your name in the button in a pop way up window
or you should use the control keys text house to examine the text message displayed inside button.
Also you can use your tag property for those who have previously assigned some text on the tag property
(like the quantity of the button).You can then employ that number plus a series involving if transactions or a new select cse function to find out which involving several numerous buttons ended up pressed (provided a person load an exclusive number to each control keys tag property).
The simplest solution I’ll think of is to Dimension a variable being an integer, such as ButNum.Then once you Then make use of the MouseEnter event of the two buttons to establish the identity from the button for you to pass towards the ButNum adjustable.
When a person’s mouse gets into button1 you can use the following code:
ButNum=1
When the mouse makes its way into button2 you can use the next code:
ButNum=2
In the Click event from the two links, use the next code:
MsgBox(“Button ” & ButNum & ” appeared to be clicked”
EDIT
I thought you knew to create the Textual content MouseEnter computer code Public as an alternative to private plus add the particular Dim ButNum seeing that integer intended for both switches.
TexMav.
Leave a Reply
You must be logged in to post a comment.