1

I have the following code:

Private Sub btnNew_Click(sender As Object, e As EventArgs) Handles btnNew.Click

    Dim f As New frmStyle
    f.ShowDialog()

End Sub

frmStyle does many things during it's Load event, so it doesn't appear immediately. Instead, it takes around 1 second to show up.

Because of that, I want to show an hourglass cursor during the form's Load event.

In VB6 it was super easy. I could just use "Screen.Cursor = vbHourglass". Then you could set the cursor back to the default from whereever you wanted, for example at the end of a Form_Load event.

How can this be done in VB.NET now?

I want to show the cursor application-wide, and not for a single control only. And ALSO (what makes my question unique and NOT answered so far in another question), I need to reset it, but it should be reset at the end of Form_Load (which is NOT the initializing element. Instead the button is the "initializing" element, but I can not set the cursor to default at the end of the button click because ShowDialog is shown modally. This means that the cursor would only be changed back if the form was closed again).

Thank you!

tmighty
  • 10,734
  • 21
  • 104
  • 218
  • `Cursor = Cursors.WaitCursor` – Reza Aghaei Sep 26 '19 at 03:23
  • https://stackoverflow.com/questions/50905079/hourglass-cursor-in-vb-net – Oleg Sep 26 '19 at 05:26
  • @RezaAghaei That is not the question. My question is about something else. I have edited my question accordingly. – tmighty Sep 26 '19 at 14:03
  • The title and first part of the question is still telling you are looking for `Cursor = Cursors.WaitCursor`. Anyway, I reopened the question, since you believe the close reason (duplicate) is not valid and added more description and asked a new thing in second part of the questio. If the main part of the question is the second part, please edit the title and rephrase the body of the question and enhance it with a minimal code to reproduce the problem. – Reza Aghaei Sep 26 '19 at 17:58
  • @RezaAghaei I think the question is how to set the Cursor application wide, isn't it? – tmighty Sep 27 '19 at 14:17
  • 1
    Great useful answer that should help you. https://stackoverflow.com/questions/302663/cursor-current-vs-this-cursor –  Oct 16 '19 at 22:40

0 Answers0