我依照VB书本上的一个简单的学生成绩管理程序代码,照着样子做出来,运行后,发现在文本框中输入了学号、姓名等,文本框里的数据全都消失了,请问怎么解决啊!急
解决方案 »
- vb 如何让窗口不能最小化 窗口置在最后?
- 如何在vbs中将一个文件路径作为数值项写入注册表
- 超难题:如何获得没有句柄的文本框里面的内容?估计没解了,有奇迹吗?
- 关于从Excel中读取数据显示到DataGrid中的问题!
- 请教大家一个基础问题
- 请问如何在vb中将sql server表或查询导出到文本文件或EXCEL文件中?
- C语言中整数表示的字节与VB写的程序进行SOCKET通讯后如何将字节转换成整型??再线等
- 如何不装MDAC连接SQL2000?
- 怎么样将自己的图标加到IE浏览器的工具栏呀!!
- 在VB中想两个程序同时打开一个MDB数据库文件,打开方式应该怎么写
- VB操作excle提示用户定义类型未定义
- 程序外挂,一个软件上有一个打印的按钮,我想做一个外挂的程序去控制这个打印按钮,应该怎么做呢?谢谢
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
Adodc1.Caption = "记录:" & (Adodc1.Recordset.AbsolutePosition) & "/" & Adodc1.Recordset.RecordCount
End SubPrivate Sub Check1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text1(3).SetFocus
End IfEnd SubPrivate Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
If Command1(0).Caption = "添加" Then
Command1(0).Caption = "确定"
Command1(1).Caption = "取消"
Adodc1.Recordset.AddNew
aa (False)
Else
Command1(0).Caption = "添加"
Command1(1).Caption = "编辑"
Adodc1.Recordset.UpdateBatch adAffectAllChapters
aa (True)
End If
Case 1
If Command1(1).Caption = "编辑" Then
Command1(0).Caption = "确定"
Command1(1).Caption = "取消"
aa (False)
Else
Command1(0).Caption = "添加"
Command1(0).Caption = "确定"
Command1(1).Caption = "取消"
Adodc1.Recordset.CancelUpdate
Adodc1.Refresh
aa (True)
End If
Case 2
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End Select
Text1(0).SetFocus
End SubPrivate Sub aa(I As Boolean)
Dim otxt As TextBox
For Each otxt In Text1
otxt.Locked = 1
Next
Command1(2).Visible = 1
Adodc1.Enabled = 1End SubPrivate Sub Form_Load()End SubPrivate Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case Index
Case 0, 1, 3, 4, 5
Text1(Index + 1).SetFocus
Case 2
Check1.SetFocus
Case 6
Text1(0).SetFocus
End Select
End If
End SubPrivate Sub Text1_Validate(Index As Integer, Cancel As Boolean)
Dim a(3 To 5) As Single
Select Case Index
Case 0 To 2
If Text1(Index).Text = "" Then
MsgBox "it must have data!"
Cancel = False
Text1(Index).SetFocus
End If
Case 3 To 5
For I = 3 To 5
a(I) = Val(Text1(I).Text)
Next
Text1(6).Text = a(3) + a(4) + a(5)
End Select
End Sub
a(I) =a(I)+ Val(Text1(I).Text)
Next