try this code in VB, it wud solve ur problem
firstly declare a public variable p
e.g.
Public p As Integer = 100 ''here i predifine the initial opacity to
100%
Then in the form load event of the form, change the opacity to ANY
VALUE OTHER THAN 1(100% Opacity)..the best is 99.9% (i.e 0.999)
e.g.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.Opacity = 0.999 ''this means opacity is set to 99.9%
End Sub
Then drop in a Timer control into tht form and write the following code
in the "elapsed" property of the timer :
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As
System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
p = p - 1 'here i gradually decrease the opacity on evry
interval of the timer
Me.Opacity = (p / 100) 'convert my value to percentage by
dividing by 100
If Me.Opacity = 0.01 Then ''if opacity reaches 1% then close
the form
Me.Close()
End If
End Sub
Finally in the "interval" property of the timer, set ur own values
according to how fast or how slow u want the form to disappear.i used
1000 (i.e. 1000 millisecs = 1 second), so the opacity is decreased by
1% every one second,so..the form becomes invisible and finally closes
in 100 seconds.YOU CAN CHANGE THIS VALUE ACCORDING TO YOUR CONVINIENCE
AS HOW FAST/SLOW U NEED YOUR FORM TO CLOSE.
u can use 500 as interval..this will close your form in 50
seconds..value 100 will close your form in 10 seconds..and so
on.........
if u want to start the vanishing upon clicking a botton/event..then at
first disable the timer and enable it on that event being fired.
ok..gud luckk
Raj