PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET
Call button click event
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET
Call button click event
![]() |
Call button click event |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I've got a form with the following controls:
txt1, txt2, txt3 and btn1, btn2 and btn3. When the user double clicked on the text box (txt1 to txt3), I will to click the corresponding buttons (btn1, btn2 or btn3). I can do the following in the text box double click event: select case sender.name case txt1.name: btn1.perform_click case txt2.name: btn2.perform_click case txt3.name: btn3.perform_click end select This works only if I know how many text boxes are in the form. If I load the text boxes and buttons at run time, may not know how many text boxes I have so I cannot use the Select Case statement to check for which text box is double clicked. I've try the following: Dim sv_str_BtnId As String Dim sv_ctl_Controls() as Button sv_str_BtnId = "btn" & Replace(sender.name, "txt", "") - this will return btn1 to btnX depending on whch text box is double clickedon. ' Now I try to find the controls. sv_ctl_Controls = Me.Controls.Find(sv_str_BtnId, False) If UBound(sv_ctl_Controls) <> -1 Then sv_ctl_Controls(0).PerformClick() End If This does not work at all - the button is not clicked. Can someone please help? |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

