Private Sub Button1_Click(sender As Object, e As System.EventArgs)具有多个带有相同签名的定义

为什么“Private Sub Button1_Click(sender As Object, e As System.EventArgs)”具有多个带有相同签名的定义。
Imports System.Data.SqlClient '添加引用命名空间
Public Class Tadd
Dim connstr As String = ("Data Source= LAPTOP-IVGA33CA;Initial Catalog=JXGL;Integrated Security=True") '建立连接
Dim conn As New SqlClient.SqlConnection(connstr)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim insertsql As String = "insert into T(t#,tnametssex,tbirthin,titleof,trsection,tel)"
Dim cmd As New SqlClient.SqlCommand(insertsql, conn)
'检查添加的教师号是否存在
Dim sqlstring As String = "select * from T where t#='" & TextBox1.Text & "' "
conn.Open()
Dim com2 As New SqlClient.SqlCommand(sqlstring, conn)
Dim read1 As SqlDataReader = com2.ExecuteReader
If read1.Read() Then
MsgBox("该教师号已存在!", MsgBoxStyle.Information, "提示!")
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = "男"
DateTimePicker1.Value = "1965/12/31"
ComboBox2.Text = ""
ComboBox3.Text = ""
TextBox3.Text = ""
ElseIf TextBox1.Text = "" Then
MsgBox("请输入教师号!", MsgBoxStyle.Information, "提示!")
ElseIf TextBox2.Text = "" Then
MsgBox("请输入姓名!", MsgBoxStyle.Information, "提示!")

Else
'添加新教师的信息
conn.Close()
cmd.Parameters.Add("@T#", SqlDbType.VarChar).Value = TextBox1.Text
cmd.Parameters.Add("@tname", SqlDbType.VarChar).Value = TextBox2.Text
cmd.Parameters.Add("@tsex", SqlDbType.VarChar).Value = ComboBox1.Text
cmd.Parameters.Add("@tbirthin", SqlDbType.VarChar).Value = DateTimePicker1.Value
cmd.Parameters.Add("@titleof", SqlDbType.VarChar).Value = ComboBox2.Text
cmd.Parameters.Add("@trsection", SqlDbType.VarChar).Value = ComboBox3.Text
cmd.Parameters.Add("@tel", SqlDbType.VarChar).Value = TextBox3.Text
conn.Open()
cmd.ExecuteNonQuery()
MsgBox("教师信息添加成功!", MsgBoxStyle.Information, "提示!")
End If
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = "男"
DateTimePicker1.Value = "1965/12/31"
ComboBox2.Text = ""
ComboBox3.Text = ""
TextBox3.Text = ""
conn.Close()
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

End Sub
End Class
...全文
266 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
用VB.NET做的小游戏--打地鼠 Public Class Form1 Inherits System.Windows.Forms.Form Dim pic As New PictureBox Dim goal As Integer Dim i As Integer Dim j As Integer Dim xx1() As Integer = {135, 277, 417} Dim xx2() As Integer = {157, 367} Dim xx3() As Integer = {32, 251, 482} Dim timer As Double = 1 Dim count As Integer '计时器跳动次数 Dim ifclick As Boolean Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Text = "小游戏" Me.Size = New Size(650, 465) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Timer1.Interval = 600 Timer1.Enabled = True Button2.Visible = True End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If Button2.Text = "暂停" Then Button2.Text = "继续" Timer1.Enabled = False PictureBox1.Enabled = False ElseIf Button2.Text = "继续" Then Button2.Text = "暂停" Timer1.Enabled = True PictureBox1.Enabled = True End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Me.Close() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ifclick = False PictureBox1.Enabled = True If timer = 0 Then Timer1.Enabled = False MsgBox("游戏结束,您的得分:" + goal.ToString) Button3.Visible = False Exit Sub End If addpic() timer = 10 - count * 0.5
在码农的生活中,很多级码农都有这样的经历,会被一个小小的技术问题拦住,然后进度跟不上了,被老板XXXX一大通了。心情不爽了。 好吧,这个曾经是我遇到拦路虎之一。但事实上不是什么大技术。技术就是一层纸,破了就破了。 这是一个关于如何跨窗体操作控件或过程的一个例子。比如,你想用窗体A的按键来执行窗体B的文本框变色。 Imports System Imports System.Threading Imports System.Text Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load CheckForIllegalCrossThreadCalls = False '不写这行,会出错,不允许线程的数据写到TextBox1.Text 中去。 Form2.Show() End Sub Private Sub form1_FormClosing(sender As Object, e As EventArgs) Handles Me.FormClosing ' If runThread.IsAlive = True Then runThread.Abort() End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click '用的是委托方式 Me.Invoke(New MethodInvoker(AddressOf THREAD2)) End Sub Private Sub THREAD2() Static j As Integer j = j + 1 TextBox1.Text = " 这是 [线程] 操作" & vbCrLf & _ " Button2被点了: " & j & " 次" & vbCrLf & "要求是from2.textbox.text= textbox1.text 。[问题]但为什么不能成功显示呢?" End Sub Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged Form2.TextBox1.Text = TextBox1.Text End Sub Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Static j As Integer j = j + 1 TextBox1.Text = " 这是 [非线程] 操作" & vbCrLf & _ "Button3 点击了: " & j & " 次" & vbCrLf & _ "要求是from2.textbox.text= textbox1.text, 可以成功显示,这个是对的。" End Sub End Class

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧