Results 1 to 2 of 2

Thread: Problem with several actions in code

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    7

    Problem with several actions in code

    HI! Can anyone help me. I'm not sure is it the right name to call Click or KeyDown as an actions but in any case I have trouble with control which have two action in my code

    The control is an TextBox named Text1 (there are several TextBoxes as an Text1 array) and the actions are GotFocus and LostFocus. Ok, if I put a code:

    Private Sub Text1_GotFocus(index as Integer)
    GetIndex = Text1(Index).Index
    End Sub

    Private Sub Text1_LostFocus(index as Integer)
    Function1
    Function2
    End Sub

    the problem occurs in run time when I move with mouse between the TextBoxes. The program reads the code only from the Private Sub Text1_LostFocus, not from the both actions. If I leave only the GotFocus action in code everything works fine. Why is that you cannot use two or more different actions for same control in your code or is there a something I did wrong?

  2. #2
    hellswraith
    Guest
    You can use more than one method of the control. Try this in your GotFocus method...
    Code:
    Private Sub Text1_GotFocus(index as Integer) 
    GetIndex = index
    End Sub
    That will get the current index of the control that has the focus.

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