Results 1 to 2 of 2

Thread: How to add a Key_Press event to an user control

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Location
    Florida, USA
    Posts
    93

    How to add a Key_Press event to an user control

    I created a user control that consists of a txt box and a drop down
    to use it as my warehouse list, the user can either enter a code in the txtbox
    (example: "04") and the drop down will display the desc of the warehouse for that code, and viceversa, now I want to add a Key_Press event..how do I do
    that???

  2. #2
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011

    Re: How to add a Key_Press event to an user control

    Quote Originally Posted by npolo
    I created a user control that consists of a txt box and a drop down
    to use it as my warehouse list, the user can either enter a code in the txtbox
    (example: "04") and the drop down will display the desc of the warehouse for that code, and viceversa, now I want to add a Key_Press event..how do I do
    that???

    y don't u use ActiveX Control Interface Wizard? that makes it a lot easier..
    in case you dont want to.. then you have to follow the following steps

    1. Create a Public Event with same signature as that of Text box KeyPress

    VB Code:
    1. Public Event KeyPress (ByRef KeyAscii As Integer)

    2.
    then code in Text1_KeyPress as follows

    VB Code:
    1. Private Sub Text1_KeyPress(ByRef KeyAscii As Integer)
    2.   RaiseEvent KeyPress (KeyAscii)
    3. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width