PC Review


Reply
Thread Tools Rate Thread

Call button click event

 
 
Young
Guest
Posts: n/a
 
      23rd May 2009
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?





 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call button click event Young Microsoft Dot NET Framework Forms 30 25th May 2009 03:25 AM
Call button click event Young Microsoft Dot NET 0 23rd May 2009 07:31 AM
Call button click event Young Microsoft Dot NET Framework 0 23rd May 2009 07:31 AM
Call button click event Young Microsoft Dot NET Framework Forms 0 23rd May 2009 07:31 AM
how to call button click event anthonymelillo Microsoft VB .NET 20 14th Oct 2003 11:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:57 PM.