Please Help me with PopUp

s3ad2002

Member
Joined
Feb 27, 2006
Messages
6
Programming Experience
1-3
Hi guys


I was trying to display a popup windows form when the mouse is over a a button and when the mouse leaves the button the popup windows closes. I found article at http://www.codeproject.com/vb/net/popup.asp which explains how I can display the popup but my

problem is that the poup will not close until the mouse is clicked outside it but what I need is that the window close when the mouse leaving the button.


Can anyone help me please


Regards

Saad
 
Thank you for your reply. I tried to do this but the problem is the form doesn't close until is the mouse clicked somewhere outside the form.


can you have a look at the article please. your help will be appreaciated.



Regards

Saad
 
I suggest you re-read the article.

QUOTED FROM THE LINK:

The popup will disappear automatically when its window is deactivated. The window is deactivated as soon as you click outside the popup

So their example YOU HAVE to click outside the box.... There is nothing on that article to suggest that the popup closes when the mouse is moved away.

As Juggalo says, use the MouseLeave event. If you display your popup as a panel, then you simply have;

VB.NET:
Private Sub btnClickMe_Click (..................)

me.panelPopUp.visible = true

End Sub


Private Sub btnClickMe_MouseLeave (...................)

me.panelPopUp.visible = false

End Sub
 
On second thought use a label. Set its visible property to false. Then use:
VB.NET:
	Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter
		Label1.Visible = True
	End Sub

	Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
		Label1.Visible = False
	End Sub
or use tool tip component.
 
Back
Top