Results 1 to 6 of 6

Thread: LostFocus not processing in a MDI Child

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75

    Question

    I have certain code that get processed on a LostFocus event in a textbox on a MDI Child.
    This code will not get processed if I choose a menu item from the MDI Form(parent).

    Is there any way to force the LostFocus to fire in this text box when a menu item is chosen from the MDI Form...or any other event that causes the LostFocus event not to be triggered.

    Thanks for the help.

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Posts
    81

    ?

    Have you tried to set focus to the other form on the event?
    -------------------------
    There is never only one right answer. That is the magic of programming.
    -------------------------

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75
    Yep I thought that would work but for some reason it didn't.
    Unsure as to how to proceed.

  4. #4
    Lively Member
    Join Date
    Jan 1999
    Posts
    81

    send me the code

    IF YOU CAN GIVE ME A CODE EXAMPLE ON HOW YOUR DOING IT... IT WOULD HELP ALOT.
    -------------------------
    There is never only one right answer. That is the magic of programming.
    -------------------------

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Location
    U.S.A.
    Posts
    75
    Sure thing just try this out.
    Create a new project and add an MDI Form
    Make Form1 an MDI Child
    Add a text box to Form1
    In the LostFocus Event of Textbox1 add this simple code:

    Code:
    If Text1.Text = "" Then Text1.Text = "0"
    Now all you have to do is add a menu to MDIForm1
    Have the menu item do whatever you want....then run the program.

    Give Text1 the focus then click on the menu in the MDIForm1.
    You will notice that the value of text1.text is not "0" as it should be.....this is my problem. I need the LostFocus even to process and by clicking on the menu in MDIForm1 this does not happen.

    Hope you can help...thanks

  6. #6
    Lively Member
    Join Date
    Jan 1999
    Posts
    81

    Smile :)

    You need to do this...

    form1.text = 0

    since your giving focus to the other form its looking for a textbox on the midi form...


    Private Sub Form_Load()
    MDIForm1.Show
    End Sub



    Private Sub Text1_LostFocus()
    MDIForm1.Show
    If Form1.Text1.Text = "" Then Form1.Text1.Text = "0"
    End Sub


    Try this and let me know if this is what you need.
    -------------------------
    There is never only one right answer. That is the magic of programming.
    -------------------------

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