Solved

textbox1 gotfocus problem

Posted on 2014-10-16
3
122 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
Comment Utility
well it looses focus when the messagebox is show and regains focus when you close it, so it is basically a loop
0
 
LVL 69

Assisted Solution

by:Éric Moreau
Éric Moreau earned 166 total points
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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