VB实训报告,学生成绩管理系统

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

附录:

一、设计的系统界面示意图

二、涉及的代码清单

简易计算器代码:

Dim v As Boolean

Dim s As String

Dim x As Double

Dim y As Double

Private Sub Command1_Click(Index As Integer) If Form.Tag = "T" Then

If Index = 10 Then

Text1.Text = "0."

Else

Text1.Text = command1(Index).Caption

End If

Form1.Tag = ""

Else

a = Text1.Text

Text1.Text = a & Command1(Index).Caption End If

End Sub

Private Sub Command2_Click(Index As Integer) Form1.Tag = "T"

If v Then

x = Text1.Text: v = Not v

Else

y = Text1.Text

Select Case s

Case 0

Text1.Text = x + y

Case 1

Text1.Text = x - y

Case 2

Text1.Text = x * y

Case 3

If y <> 0 Then

Text1.Text = x / y

Else

MsgBox ("不能以0为除数") Text1.Text = x

v = False

End If

End Select

x = Text1.Text

End If

s = Index

End Sub

Private Sub Command3_Click() Form1.Tag = "t": y = Text1.Text Select Case s

Case 0

Text1.Text = x + y

Case 1

Text1.Text = x - y

Case 2

Text1.Text = x * y

Case 3

If y <> 0 Then

Text1.Text = x / y

Else

MsgBox ("不能以0为除数")

Text1.Text = x

End If

End Select

x = Text1.Text: y = 0: v = False: s = 5

End Sub

学生成绩查询代码:

Private Sub Form_Load() '初始化开的课程,在这里所有的班级都开设了这九门课程!

Combo1.AddItem "数学"

Combo1.AddItem "语文"

Combo1.AddItem "英语"

Combo1.AddItem "生物"

Combo1.AddItem "化学"

Combo1.AddItem "物理"

Combo1.AddItem "政治"

Combo1.AddItem "历史"

Combo1.AddItem "地理"

End Sub

Private Sub command4_Click()

Dim a As Single

Dim b As Integer

Dim c As String

If Combo1.Text = "数学" Then

Adodc1.Recordset("数学成绩") = Text3.Text

Adodc1.Recordset.Update

End If

If Combo1.Text = "语文" Then

Adodc1.Recordset("语文成绩") = Text3.Text

Adodc1.Recordset.Update

End If

If Combo1.Text = "英语" Then

Adodc1.Recordset("英语成绩") = Text3.Text

Adodc1.Recordset.Update

End If

If Combo1.Text = "生物" Then

Adodc1.Recordset("生物成绩") = Text3.Text

Adodc1.Recordset.Update

End If

If Combo1.Text = "化学" Then

Adodc1.Recordset("化学成绩") = Text3.Text

Adodc1.Recordset.Update

End If

If Combo1.Text = "物理" Then

Adodc1.Recordset("物理成绩") = Text3.Text

Adodc1.Recordset.Update

End If

If Combo1.Text = "政治" Then

Adodc1.Recordset("政治成绩") = Text3.Text

Adodc1.Recordset.Update

End If

If Combo1.Text = "历史" Then

Adodc1.Recordset("历史成绩") = Text3.Text

Adodc1.Recordset.Update

End If

If Combo1.Text = "地理" Then

Adodc1.Recordset("地理成绩") = Text3.Text

Adodc1.Recordset.Update

End If

Adodc1.Recordset("学生总分") = Val(Adodc1.Recordset("数学成绩")) + Val(Adodc1.Recordset("语文成绩")) + Val(Adodc1.Recordset("英语成绩")) + Val(Adodc1.Recordset("化学成绩")) + Val(Adodc1.Recordset("生物成绩")) +

相关文档
最新文档