我是才学的,关于一串代码我看不懂!求助!
Dim aPrivate Sub Cmd_Hide_Click()
frm_YHGL.Hide
End Sub
Private Sub Command1_Click()
Call main
Adodc1.RecordSource = "select * from Table_yhxx"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text6.Text = Val(Adodc1.Recordset.Fields("ID")) + 1 Else
Text6.Text = 1
End If
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "输入不完全!!", 48, "医院住院管理系统"
Else
If Text2.Text = Text3.Text Then
Set adoRs = adoCon.Execute("insert into Table_yhxx values(" & Text6 & ",'" & Text1 & "','" & Text2 & "','" & Check1 & "','" & Check2 & "','" & Check3 & "','" & Check4 & "','" & Check5 & "','" & Check6 & "','" & Check7 & "','" & Check8 & "','" & Check9 & "','" & Check10 & "')")
MsgBox "注册成功!!", 48, "医院住院管理系统"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
frm_YHGL.Hide
Else
MsgBox "两次输入的密码不一致,请您确认后重新输入", 48, "医院住院管理系统"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
End If
End If
adoCon.Close
End Sub
Private Sub Command2_Click()
a = MsgBox("您确认要删除该用户吗?", 17, "医院住院管理系统")
If a = vbOK Then
Adodc1.RecordSource = "select * from Table_yhxx where 用户名='" + Text4.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
frm_YHGL.Hide
Else
MsgBox "没有该用户的信息,请您确认后重新输入", 32, "医院住院管理系统"
Text4.SetFocus
End If
Else
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
frm_RYXS.Show
frm_RYXS.Caption = "用户删除"
End Sub
Private Sub Form_Activate()
If Option1.Value = 1 Then
Frame2.Visible = True
Frame1.Visible = False
Command1.Visible = True
Command2.Visible = False
ElseIf Option2.Value = 1 Then
Frame1.Visible = True
Frame2.Visible = False
Command2.Visible = True
Command1.Visible = False
Else
End If
End Sub
Private Sub Label3_Click()
End Sub
Private Sub Option1_Click()
Frame2.Visible = True
Frame1.Visible = False
Command1.Visible = True
Command2.Visible = False
Text1.SetFocus
End Sub
Private Sub Option2_Click()
Frame1.Visible = True
Frame2.Visible = False
Command2.Visible = True
Command1.Visible = False
Text4.SetFocus
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text2.SetFocus
Else
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text3.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
Call main
If KeyCode = 13 Then
Adodc1.RecordSource = "select * from Table_yhxx"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveLast
Text6.Text = Val(Adodc1.Recordset.Fields("ID")) + 1 Else
Text6.Text = 1
End If
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "输入不完全!!", 48, "医院住院管理系统"
Else
If Text2.Text = Text3.Text Then
Set adoRs = adoCon.Execute("insert into Table_yhxx values(" & Text6 & ",'" & Text1 & "','" & Text2 & "','" & Check1 & "','" & Check2 & "','" & Check3 & "','" & Check4 & "','" & Check5 & "','" & Check6 & "','" & Check7 & "','" & Check8 & "','" & Check9 & "','" & Check10 & "')") MsgBox "注册成功!!", 48, "医院住院管理系统"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
frm_YHGL.Hide
Else
MsgBox "两次输入的密码不一致,请您确认后重新输入", 48, "医院住院管理系统"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
End If
End If
Else
End If
adoCon.Close
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
a = MsgBox("您确认要删除该用户吗?", 17, "医院住院管理系统")
If a = vbOK Then
Adodc1.RecordSource = "select * from Table_yhxx where 用户名='" + Text4.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
frm_YHGL.Hide
Else
MsgBox "没有该用户的信息,请您确认后重新输入", 32, "医院住院管理系统"
Text4.SetFocus
End If
Else
End If
Else
End If
End Sub
我是才开始学习VB的菜鸟,不过会是一个很努力的临时菜鸟,所以刚开始提问求助的时候可能会把我的问题说得不清楚,请大家多多体谅,我会应大家要求再来完善我的问题的!
这段代码是一个关于注册用户的窗体的代码,这个窗体上有3个TextBox控件、3个Label控件、1个Adodc控件、1个Frame控件和2个CommandButton控件.这个窗体的样子在附件中!这段代码中的红色部分我怎么也看不懂,是怎么一回事!还有那个Text4、Text6是哪儿冒出来的呀,怎么就出来了个Text6呢!谢谢大家能够指点指点我!