Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Handler's (Finding Which Control)

Status
Not open for further replies.

0CODE

Programmer
Feb 8, 2004
63
CA
hey, I have a multiple handle procedure and all i need to do is found out which control activated the event (I think it has to do with the "sender")



Private Sub alltxts_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles sdt1.KeyPress, sdt2.KeyPress, sdt3.KeyPress, sdt4.KeyPress, sdt5.KeyPress, sdt6.KeyPress, sdt7.KeyPress, sdt8.KeyPress

If valtxt(e.KeyChar) = False And Asc(e.KeyChar) <> Keys.Back Then e.Handled = True : MsgBox(&quot;You can only enter numbers and decimals&quot;)
End Sub


(for ex: if sdt6_keypress was the one who triggered the event)

______
thanks
 
thanks, what if the senders were different controls, how would you work with that, prob. with &quot;gettype&quot;.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top