MDI bug? 
Author Message
 MDI bug?

Hello,

I have a problem with the LOSTFOCUS event of a textbox which only happens
if I am using MDI form.  It is perfectly alright when used on a non-mdi form.

Supposedly I have got 2 text boxes.  These 2 text boxes are meant to
capture the start-date and end-date of a product.  Everytime 1 of these
text boxes loses the focus, I will check the text and format it into a
date if it is valid.  If the date is invalid, a messge box pops up saying
invalid date.  Input of date in text box 1 is followed immediately at
text box 2.

Sub text1_lostfocus()

    if isdate (format$ (text1.text, "d/mm/yy") ) then
       text1.text = format$ (text1.text)
    else
       msgbox "Invalid Date for Start Date", ,"Invalid Data"
    end if      

End Sub

Sub text2_lostfocus()

    if isdate (format$ (text2.text, "d/mm/yy") ) then
       text2.text = format$ (text2.text)
    else
       msgbox "Invalid Date for End Date", ,"Invalid Data"
    end if

End Sub

The problem:  

When the text entered in TEXT BOX 1 is invalid, it first
gives a msgbox saying "Invalid Date for Start Date".  After u press the
ok button, the system keeps on giving a msgbox saying "Invalid Date for
End Date" and it won't stop!  U press ok button and it keeps coming up
again.  Something seems to have toggled the text2_lostfocus event.  But I
am very sure there is nowhere in my codes I have toggled this event.

If the dates entered are correct, then there is no problem.  But when it
is wrong, the program goes into an endless loop.  The codes seem simple
and straight forward enough.

To make sure I am right, I changed the form into a non-mdi one and it
worked perfectly!  When an invalid date is entered, it just shows 1
msgbox and lets u continue.  It is not like when the form is a mdi form
where u keep on getting the msgbox again and again.

Is this some kind of bug associated with MDI-forms?
The worst is when I use DEBUG to toggle a breakpoint at the line
msgbox... , it works fine... showing the msgbox only once... BUT once I
remove the breakpoint, and continue running, the problem comes back
again... very strange.

Can someone please help?

Thanx in advance.



Tue, 08 Sep 1998 03:00:00 GMT  
 MDI bug?
On Fri, 22 Mar 1996 10:57:59 +0800, Boon Ju

Quote:

>Hello,

>I have a problem with the LOSTFOCUS event of a textbox which only happens
>if I am using MDI form.  It is perfectly alright when used on a non-mdi form.
> <<< snip >>>

I copied your code into VB 4.0 (32bit) and it worked like a charm
within a MDI form.  Are you using VB 3.0 or 4.0?  If you are using
4.0, are you using 16 or 32-bit?

You might want to test printing a string on the debug window instead
of popping up the MsgBox just to see if the Msgbox receiving the focus
is causing the behavior.  But like I said, it works fine in my
environment...

Jeff



Wed, 09 Sep 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. FIX: VB6 Maximize MDI Bug

2. Crystal 4.6 MDI bug

3. MDI-List Bug? - WindowsApplication5.zip [0/1]

4. A bug in opacity processing and MDI forms

5. BUG: MDI ClientSize fails to update on docked control resize

6. BUGS in MDI Children forms

7. ****ANYONE EXPERIENCE BUG WITH MAX WIN95 MDI CHILD FORM??***

8. HELP: BUG: Maximized Win95 MDI Child Form Disappears

9. VB Bug? - Menu Items when using MDI Form

10. MDI children LostFocus bug?

11. MDI w/ Visual Controls Bug

12. MDI Form BUG!!

 

 
Powered by phpBB® Forum Software