-
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.
-
?
Have you tried to set focus to the other form on the event?
-
Yep I thought that would work but for some reason it didn't.
Unsure as to how to proceed.
-
send me the code
IF YOU CAN GIVE ME A CODE EXAMPLE ON HOW YOUR DOING IT... IT WOULD HELP ALOT.
-
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 :)
-
:)
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.