Thumbs up[Tutorial] fade in/out effect

PollDid this tutorial help you?
9 votes
Posts 15 of 5 · Page 1 of 1
[Tutorial] fade in/out effect
Hi, and welcome to my first tiny Visual Basic.Net tutorial.
In this tutorial i will show you how to let a form fade in and out.

First off all, you need to open Microsoft Visual Basic 2008 Express Edition and start a new Windows Form Application.

Now that you have made your form,
you will need to place a button. (for the fade out effect)
After you are done, your form should look like this:

Now double click your form and you should get this:

Now you have to put
Code:
        Dim fadeinout As Double
        For fadeinout = 0 To 1.01 Step 0.01
            Me.Opacity = fadeinout
              Next
between

Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
so you should get this:

Now press the 'Debug Button' to see the fade in effect:

and now your Form1 should fade in when you start it.

Now lets do the fade out effect with the button.(This can also be done for closing the form, but ill stick with the button for now)

You should have the folowing code atm:
Code:
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim fadeinout As Double
        For fadeinout = 0 To 1.01 Step 0.01
            Me.Opacity = fadeinout
        Next
    End Sub
End Class
Now double click your Button1 and this should appear
Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    End Sub
End Class
Put
Code:
        Dim fadeout As Double
        For fadeout = 1 To 0 Step -0.001
            Me.Opacity = fadeout
        Next
Between:
Code:
 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    End Sub
End Class
And now you should have:
Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim fadeout As Double
        For fadeout = 1 To 0 Step -0.001
            Me.Opacity = fadeout
        Next
    End Sub
End Class
Now press the debug button again.

And now your form will fade in and out!
I hope this tutorial helped you.
1.jpgattachment deleted · 118 downloads before removal
2.jpgattachment deleted · 111 downloads before removal
3.jpgattachment deleted · 112 downloads before removal
4.jpgattachment deleted · 113 downloads before removal
5.jpgattachment deleted · 116 downloads before removal
nothinck happens
u only can´t see the button and the form 1 but nothing otheer happenz
Ammm it works BUT
When u click On the button.
The project gone
then
u cant close it
so its unusefull
Dident Helped Sorry
it worked for me

that is a cool tut u got there
Posts 15 of 5 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?