MSGBox in LostFocus cancel event GotFocus 
Author Message
 MSGBox in LostFocus cancel event GotFocus

Hi,
  My friend as me this question (and I donot know why it happen).  He have a
form with 2 textbox (eg. text1 and text2) and in Text1_LostFocus he wrote a
code to show msgbox and in Text2_GotFocus he also wrote a code to show
anther msgbox.  What hannpen is when the focus move from text1 to text2 he
got the msgbox from Text1_LostFocus but not msgbox from Text2_GotFocus
(although the focus come to Text2).  He want to know how to fix this (to get
both msgbox).
TIA
Thit.


Thu, 29 Apr 2004 01:55:55 GMT  
 MSGBox in LostFocus cancel event GotFocus
Well the MsgBox 'grabs' focus so the second Textbox does not get focus
- well it can't really - there is a glaring MsgBox hogging all user
input.

On Sun, 11 Nov 2001 00:55:55 +0700, "Thit Siriboon"

Quote:

>Hi,
>  My friend as me this question (and I donot know why it happen).  He have a
>form with 2 textbox (eg. text1 and text2) and in Text1_LostFocus he wrote a
>code to show msgbox and in Text2_GotFocus he also wrote a code to show
>anther msgbox.  What hannpen is when the focus move from text1 to text2 he
>got the msgbox from Text1_LostFocus but not msgbox from Text2_GotFocus
>(although the focus come to Text2).  He want to know how to fix this (to get
>both msgbox).
>TIA
>Thit.



Thu, 29 Apr 2004 02:39:15 GMT  
 MSGBox in LostFocus cancel event GotFocus
Text2 would not get focus in this case, but you could simulate the focussing
on Text2 in the Text1_LostFocus() procedure.

Private Sub Text1_LostFocus()

MsgBox "Text1 lost focus"
If Text2 = ActiveControl Then
    Text2_GotFocus
End If

End Sub

Private Sub Text2_GotFocus()

MsgBox "Text2 got focus"

End Sub



Quote:
> Hi,
>   My friend as me this question (and I donot know why it happen).  He have
a
> form with 2 textbox (eg. text1 and text2) and in Text1_LostFocus he wrote
a
> code to show msgbox and in Text2_GotFocus he also wrote a code to show
> anther msgbox.  What hannpen is when the focus move from text1 to text2 he
> got the msgbox from Text1_LostFocus but not msgbox from Text2_GotFocus
> (although the focus come to Text2).  He want to know how to fix this (to
get
> both msgbox).
> TIA
> Thit.



Thu, 29 Apr 2004 07:01:51 GMT  
 MSGBox in LostFocus cancel event GotFocus
Actually, when your app is compiled to an exe, both the Text1 LostFocus and
the Text2 GotFocus fire correctly, and all code in them is executed. The two
Message Boxes also both appear, but not necessarily in the expected order.
If you run the app in the IDE then Text2 GotFocus does not fire, but then
there are lots of things that happen incorrectly when an app is run in the
IDE, so I wouldn't worry too much about it.

Mike


Quote:
> Well the MsgBox 'grabs' focus so the second Textbox does not get focus
> - well it can't really - there is a glaring MsgBox hogging all user
> input.

> On Sun, 11 Nov 2001 00:55:55 +0700, "Thit Siriboon"

> >Hi,
> >  My friend as me this question (and I donot know why it happen).  He
have a
> >form with 2 textbox (eg. text1 and text2) and in Text1_LostFocus he wrote
a
> >code to show msgbox and in Text2_GotFocus he also wrote a code to show
> >anther msgbox.  What hannpen is when the focus move from text1 to text2
he
> >got the msgbox from Text1_LostFocus but not msgbox from Text2_GotFocus
> >(although the focus come to Text2).  He want to know how to fix this (to
get
> >both msgbox).
> >TIA
> >Thit.



Thu, 29 Apr 2004 11:39:43 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. GotFocus event not occurring after MsgBox

2. Is there something between lostfocus and gotfocus

3. Using the caret with GotFocus and LostFocus

4. GotFocus, SetFocus, & LostFocus

5. Question on LostFocus, SetFocus, & GotFocus

6. LostFocus, GotFocus, SetFocus Question

7. Confused about GotFocus and LostFocus

8. gotfocus and lostfocus property?

9. LostFocus, GotFocus, SetFocus Question

10. VB error 5 - using gotfocus and lostfocus

11. GotFocus LostFocus done globally?

12. GotFocus/LostFocus changes

 

 
Powered by phpBB® Forum Software