Link to home
Start Free TrialLog in
Avatar of cmdolcet
cmdolcetFlag for United States of America

asked on

How to delete a User control on a mouse leave event?

How can I delete the control when I move off the mouse hover over if a label. The code is below:

  Private UserControl As UcGauges = New UcGauges
    Private Sub lblGaugeID_EditScreenDescription_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblGaugeID_EditScreenDescription.MouseHover
        Using tempUcGauges As Form = New Form
            tempUcGauges.Location = New Point(300, 300)
            tempUcGauges.Controls.Add(UserControl)
            tempUcGauges.TopMost = True
            tempUcGauges.ShowDialog()
        End Using
    End Sub
   
 Private Sub lblGaugeID_EditScreenDescription_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblGaugeID_EditScreenDescription.MouseLeave

    End Sub
End Class

Open in new window

Avatar of Ark
Ark
Flag of Russian Federation image

What do you mean by "Delete control"? Seeting UserControl = Nothing? Or removing user control from tempUcGauges form? Or hiding form/control?
Avatar of cmdolcet

ASKER

Ark,

It would be removing the control after I leave the mouse hover area.

The form appears just fine but its removing it once the user moves the mouse off the intended area.
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial