Home > Net > Turn a great god, and the two form how to switch?
Turn a great god, and the two form how to switch?
Time:11-08
Private Sub form1_Load (sender As Object, As EventArgs e) Handles MyBase. Load Dim timer1 As New Timer Timer1. Enabled=True Timer1. Start () Timer1. Interval=300
End Sub
Private Sub Timer1_Tick (ByVal sender As System. Object, ByVal e the As System. EventArgs) Me. Hide () Form2. The Show () End Sub
I this code, no response
CodePudding user response:
You have too many this code problem, 1. Timer1 is a local variable 2. Less Timer1_Tick also Handles statement
Changed once, to play:
Public Class Form1
Dim WithEvents timer1 As New Timer
Private Sub Form1_Load (sender As Object, As EventArgs e) Handles MyBase. Load
Timer1. Interval=3000 Timer1. Enabled=True
End Sub
Private Sub Timer1_Tick (sender As Object, As EventArgs e) Handles timer1. Tick
If Me. Visible Then
Me. Hide () Form2. The Show ()
The Else
Form2. Hide () Me. The Show ()
End the If
End Sub
The End of the Class
CodePudding user response:
As a form of two panel, by setting the visible to switch back and forth
CodePudding user response:
Resize form2 method is different from vb6, must first establish an instance, and then show Dim frmNew as new form2 FrmNew. Show
There are also some problems: Timer1. Enabled=True Timer1. Start () Timer1. Interval=300 Before and after the change Timer1. Interval=300 Timer1. Enabled=True
In addition, the timer1. Start () there is no need to use,