B
Badtaste2k
Hi, I just learned about adding controls to a userform through coding and it
seems very useful. However, i was wondering if it is possible to make the
controls added use _change functions?
For example, on my code i have a textbox added when a user clicks a button.
I name the textbox "Scan2"
I know i can access the data in the new textbox by using
userform1.controls("Scan2") However, i need to use a function that evaluates
each character entered into the box and wait's for a ctrl key (chr(10)) to
be pressed. When pressed, it runs a different function.
If i had hard coded the textbox, i would use
Private Sub Scan2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = 17 Or KeyCode = 13 Then
call searchdata()
KeyCode = 0
End If
End Sub
any help would be great.
oh, i tried doing private sub homer.controls("scan2")_keydown...etc.. but of
course that didn't work. It's never that easy![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Dan Butler
(e-mail address removed)
seems very useful. However, i was wondering if it is possible to make the
controls added use _change functions?
For example, on my code i have a textbox added when a user clicks a button.
I name the textbox "Scan2"
I know i can access the data in the new textbox by using
userform1.controls("Scan2") However, i need to use a function that evaluates
each character entered into the box and wait's for a ctrl key (chr(10)) to
be pressed. When pressed, it runs a different function.
If i had hard coded the textbox, i would use
Private Sub Scan2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal
Shift As Integer)
If KeyCode = 17 Or KeyCode = 13 Then
call searchdata()
KeyCode = 0
End If
End Sub
any help would be great.
oh, i tried doing private sub homer.controls("scan2")_keydown...etc.. but of
course that didn't work. It's never that easy
Dan Butler
(e-mail address removed)