Search code examples
vb.netshow-hidefadeout

Hide form without a fading effect in VB.net


I am using 2 forms in my project. I want to hide the main form and open the second when a button is clicked.

NOTE: Both forms look exactly the same

I use this code, and it works fine:

Me.Hide()
Form2.Show()

The only problem is that there is a closing / fading effect when the main form is being hidden... However I want it to be instant (So users shouldn't notice that anything happened)

Is this possible? If so, I would appreciate it if you could tell me how to do this...


Solution

  • You can set the form opacity to 0 then show form2

    Me.Opacity = 0
    Form2.Show()
    Me.Hide()
    Me.Opacity = 100
    

    Then set opacity to 100 after your main form has been hidden