Using the Load and Unload events of the Forms add these subs to handle a simple fade in and out effect. This is not limited to just one form. The subroutine definition can be added to any global class allowing the use on any form or sub-form.

AndreRet commented: Nicely done. +6
'Handle Fade in of form
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)_
Handles MyBase.Load
End Sub

'Handle Fade Out of form
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
End Sub

'Fade in
Public Sub fade_in()
    For FadeIn = 0.0 To 1.1 Step 0.1
        Me.Opacity = FadeIn
End Sub

'Fade out:
Public Sub fade_out()
    For FadeOut = 90 To 10 Step -10
        Me.Opacity = FadeOut / 100
End Sub
About the Author

I am a network engineer that loves to code. I started on the Aquarius systems, and used just about every system until the home brew revolution started. Since then I have been an IT technician that loves to code and fix things that most people can't. This is my way of thanking those who have taught me well. I hope that I can help with any code that is puzzling to the masses.

Plain and simple, nice.:)

This one is nice and simple...!!!!

Thanks man....!!!

Thanx to Unhnd_Exception For a Mod.. Here is a sub that will work for all controls or forms when the form shows. There is a revision issue for the form based on your .NET version and/or the VB Studio version as the libraries handle the code diffrently. Kudos for the Mod!!

Private Sub FadeForm(ByVal TotalSeconds As Single)
    If TotalSeconds = 0 Then
        Me.Opacity = 1
        Exit Sub
    End If

    Dim [then] As Double = DateAndTime.Timer
    Dim difference As Double = 0

    'difference is the percentage of the total seconds elapsed
    Do While difference < 1
        Me.Opacity = difference
        difference = (DateAndTime.Timer - [then]) / TotalSeconds

    Me.Opacity = 1

End Sub

Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
End Sub

C# code please..........

Code has been posted in the C# snippet forum today.

The Simplest Way is ------
(I checked it in vb 2008..)

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End Sub

 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Me.Opacity = Me.Opacity - 0.1R
End Sub