button click
-
hi, i have two buttons in my form - named button1 and button2.now in the following handler , can i add the two button click events? like private sub button_click(byval sender as system.objects , byval e as system.eventargs)handles button1.click , button2.click end sub
-
hi, i have two buttons in my form - named button1 and button2.now in the following handler , can i add the two button click events? like private sub button_click(byval sender as system.objects , byval e as system.eventargs)handles button1.click , button2.click end sub
If clicking the two buttons causes the same code to execute, why do you need two buttons? ------------------------------------------- Damian - Man of changing signature.
-
If clicking the two buttons causes the same code to execute, why do you need two buttons? ------------------------------------------- Damian - Man of changing signature.
No, further i want to do code to distinguish between two button , whether i have clicked button1 or button2 .Is it possible???????
-
No, further i want to do code to distinguish between two button , whether i have clicked button1 or button2 .Is it possible???????
Yes, the sender parameter tells you which button was clicked. Check out the following link for details: http://www.samspublishing.com/articles/article.asp?p=102148&seqNum=3&rl=1[^]
-
Yes, the sender parameter tells you which button was clicked. Check out the following link for details: http://www.samspublishing.com/articles/article.asp?p=102148&seqNum=3&rl=1[^]
I did not get the meaning of DirectCast(sender, Button) Private Sub LotsOfButtons( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles Button1.Click, Button2.Click, _ Button3.Click, Button4.Click, _ Button5.Click, Button6.Click, _ Button7.Click, Button8.Click, _ Button9.Click, Button10.Click Dim clickedBtn As Button If TypeOf sender Is Button Then clickedBtn = DirectCast(sender, Button) MsgBox(clickedBtn.Text) End If End Sub Should i imports any framework class to use this function?
-
Yes, the sender parameter tells you which button was clicked. Check out the following link for details: http://www.samspublishing.com/articles/article.asp?p=102148&seqNum=3&rl=1[^]
is DirectCast(sender, Button) some sort of CTYpe(sender,button) ? If yes then DirectCast is any predefined function??????
-
is DirectCast(sender, Button) some sort of CTYpe(sender,button) ? If yes then DirectCast is any predefined function??????
See this link: http://www.codeproject.com/useritems/DirectcastVsCtype.asp[^]
-
hi, i have two buttons in my form - named button1 and button2.now in the following handler , can i add the two button click events? like private sub button_click(byval sender as system.objects , byval e as system.eventargs)handles button1.click , button2.click end sub
Making the two function either it is user define e.g private sub button1_click(byval sender as system.objects , byval e as system.eventargs)handles button1.click and Change the Name Of Second Function and replace the Handeler name Button2 Please try it
-
hi, i have two buttons in my form - named button1 and button2.now in the following handler , can i add the two button click events? like private sub button_click(byval sender as system.objects , byval e as system.eventargs)handles button1.click , button2.click end sub
by using the following code you can distinguish between the two buttons Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click, Button5.Click Dim btn As Button = CType(sender, Button) If btn.Text = "ASDFS" Then Else End If End Sub
shally