Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Windows.Forms.Cursor.Hide()

Posted on 2009-04-14
2
521 Views
Last Modified: 2012-08-13
in Form2_Load i use Windows.Forms.Cursor.Hide()

then ..

on Form2_Load

Windows.Forms.Cursor.Show()

so far so good .. now i want the cursor hidden again when a close button on form2 is pressed or a user hits close button in the FormBorder..

On Event: Form2_Closing : Windows.Forms.Cursor.Hide()

This Event should be trigger both when the close button is hit on the FormBorder as wel on the when Button1 on Form2 is clicked ..

For some reason this is not working




Private Setup_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
       
      Windows.Forms.Cursor.Hide()
 
    End Sub
 
 
    Private Sub Setup_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
        Windows.Forms.Cursor.Show()
 
    End Sub
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        Me.Close()
 
    End Sub

Open in new window

0
Comment
Question by:Amien90
2 Comments
 
LVL 17

Accepted Solution

by:
Daniel Reynolds earned 500 total points
ID: 24143183
Perhaps you need to set a global cursor state flag and then when the first form gets the focus back, check the cursor status flag and set it appropriately.
0
 

Author Comment

by:Amien90
ID: 24151302
Windows.Forms.Cursor.Hide() is the global cursus state flag i think. Whats the event is fired right afte form1 gets back in focus?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

856 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