文档详情

VB课程设计题目设备管理系统.doc

发布:2017-12-18约4.94千字共11页下载文档
文本预览下载声明
VB程序设计 课程设计一、课程设计的与要求课程设计的与要求1、教学2、教学要求 从课程设计的出发,Private Sub Command1_Click() Form2.Show End Sub (2)查看设备 Form2 代码如下: Private Sub Command1_Click() Adodc1.Recordset.MovePrevious ’数据移到上一条 If Adodc1.Recordset.BOF Then Adodc1.Recordset.MoveFirst MsgBox 已经是第一条 End If End Sub Private Sub Command2_Click() Adodc1.Recordset.MoveNext ’ 数据移到下一条 If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast MsgBox 已经是最后一条 End If End Sub Private Sub Command3_Click() Form3.Show End Sub Private Sub Command4_Click() Form4.Show End Sub Private Sub Command5_Click() On Error Resume Next If MsgBox(确定删除该记录?, vbOKCancel, 提示) = vbOK Then Adodc1.Recordset.Delete ’删除正显示的记录 Adodc1.Recordset.MoveNext ’显示下一条数据 If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast End If End If End Sub Private Sub Command6_Click() End End Sub Private Sub Command7_Click() Adodc1.Recordset.MoveFirst ’ 显示第一条数据 End Sub Private Sub Command8_Click() Adodc1.Recordset.MoveLast ’ 显示最后一条数据 End Sub (3)添加设备 Form3 代码如下: Private Sub Command1_Click() Adodc1.Refresh Adodc1.Recordset.AddNew Adodc1.Recordset.Fields(1) = Trim(Text1) Adodc1.Recordset.Fields(2) = Trim(Text2) Adodc1.Recordset.Fields(3) = Trim(Text3) Adodc1.Recordset.Fields(4) = Trim(Text4) Adodc1.Recordset.Fields(5) = Trim(Text5) Adodc1.Recordset.Fields(6) = Trim(Text6) ’将文本框中的值赋值给数据库 Adodc1.Recordset.Update Adodc1.Recordset.MoveLast MsgBox 该设备已添加 End Sub Private Sub Command2_Click() Text1.Text = Text2.Text = Text3.Text = Text4.Text = Text5.Text = Text6.Text = End Sub Private Sub Command3_Click() Unload Me Form2.Show End Sub Form4 代码如下: Private Sub Command1_Click() Dim check As Integer Adodc1.Refresh Adodc1.Recordset.MoveFirst M = Trim(Text1) While Adodc1.Recordset.EOF True If Adodc1.Recordset.Fields(1) = M Then Text2.Text = Adodc1.Recordset.Fields(2) Text3.Text = Adodc1.Recordset.Fields(3) Text4.Text
显示全部
相似文档