我正在使用vb,当用户输入正确的名称和密码后,在我的表单上有picuterbox(汽车),然后按登录按钮,汽车将从(向左书写)移动,但我不知道我应该放在哪里运动代码???我把它放在表格的计时器上,当我打开表格时,汽车直接移动. 我想要(登录按钮)上的移动代码(如果username& password = correct)如何???????????????????????????? 我刚刚用以下代码制作了一个计时器:
I am using vb and on my form there is picuterbox (car) when user insert the correct name and password then press on login button the car will move from (left to write) but i dont know where i should put the code of movement??? i had put it on the timer of the form and when i open the form the car move directly.. i want the code of movement on the (login button)(if username&password=correct)how?????????????????????????? i had just make a timer with this code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick PictureBox3.Left = PictureBox3.Left + 100 End Sub这是登录名的验证:
and this is the validition of the login:
Private Sub Piclog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Piclog.Click Try If txtname.Text.Trim() = "" Or txtpass.Text.Trim() = "" Then My.Computer.Audio.Play(My.Resources.Windows_Error, AudioPlayMode.Background) MessageBox.Show("Invalid Username or Password") Exit Sub End If If Combolevel.Text = "" Then MessageBox.Show("You should select your level") End If Catch ex As Exception MessageBox.Show(ex.Message) Me.Hide() End Try Select Case Combolevel.SelectedIndex Case 0 My.Computer.Audio.Play(My.Resources.ss, AudioPlayMode.Background) loading.Show() Case 1 My.Computer.Audio.Play(My.Resources.ss, AudioPlayMode.Background) Loading2.Show() End Select End Sub推荐答案
请确保您的计时器已禁用,然后在用户输入正确的密码时启用它. make sure that your timer is disabled and then enable it when the user enters the correct password.
更多推荐
我应该在哪里放置这段代码
发布评论