Allora puoi riciclare quasi completamente il codice postato in precedenza...
Non l'ho collaudato ma dovrebbe andare.codice:Public Class Form1 Private formToShow As Form Dim value As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Interval = 30 Timer1.Enabled = False ProgressBar1.Minimum = 0 ProgressBar1.Maximum = 50 ProgressBar1.Value = 0 Button1.Tag = form2 Button2.Tag = form3 Button3.Tag = form4 'altri eventuali assegnamenti dello stesso tipo End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Value += 1 If ProgressBar1.Value = ProgressBar1.Maximum Then ProgressBar1.Value = 0 Timer1.Enabled = False form2.Close() form3.Close() form4.Close() 'altre eventuali chiusure di form formToShow.Show() End If End Sub Private Sub Buttons_MouseEnter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseEnter, Button2.MouseEnter, Button3.MouseEnter 'eventualmente anche altri Handles dello stesso genere Timer1.Enabled = True ProgressBar1.Value = 0 formToShow = DirectCast(sender, Control).Tag End Sub Private Sub Button1_MouseLeave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave, Button2.MouseLeave, Button3.MouseLeave 'c.s. Timer1.Enabled = False End Sub End Class

Rispondi quotando