Reputation: 157
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...
Upvotes: 1
Views: 805
Reputation: 1060
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
Upvotes: 4
Reputation: 728
You could possible improve the effect by showing Form2
first and then after a very slight pause hide Form1
.
Form2.Show()
Threading.Thread.Sleep(100)
Hide()
Doesn't quite achieve the instantaneous effect but as Form1
is now in the background it isn't quite so noticeable.
Upvotes: 1