Solved

textbox1 gotfocus problem

Posted on 2014-10-16
3
125 Views
Last Modified: 2014-10-17
Hi Experts
I have the following code


    Private Sub ModelBox_GotFocus(sender As Object, e As EventArgs) Handles ModelBox.GotFocus      
        MsgBox("wait")
    End Sub

When the mailbox gets the focus
It loops for 30 times
I do not understand why


it should only display wait messagebox once


Please help
0
Comment
Question by:b001
3 Comments
 
LVL 21

Assisted Solution

by:Randy Poole
Randy Poole earned 167 total points
ID: 40385176
well it looses focus when the messagebox is show and regains focus when you close it, so it is basically a loop
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 166 total points
ID: 40385780
a msgbox is not a good idea in this case as explained by Randy.

why do you need to put this msgbox there? if it is only to trace it, set a label with the current time and it won't steal the focus
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 167 total points
ID: 40385880
Use the Enter event instead. It is called when the control first receives the focus, but won't trigger again unless the cursor moves to another control on the form and comes back. The MessageBox thus have no effect on it.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now