我应该在哪里放置这段代码

编程入门 行业动态 更新时间:2024-10-19 04:23:04
本文介绍了我应该在哪里放置这段代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用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.

更多推荐

我应该在哪里放置这段代码

本文发布于:2023-11-14 00:28:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585719.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:这段   代码

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!