使用VB编写设计计算语文、数学、英语这三门课程平均成绩的程序,利用文本框作数据的输入和输出
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/14 14:58:04
使用VB编写设计计算语文、数学、英语这三门课程平均成绩的程序,利用文本框作数据的输入和输出
使用VB编写设计计算语文、数学、英语这三门课程平均成绩的程序,利用文本框作数据的输入和输出
使用VB编写设计计算语文、数学、英语这三门课程平均成绩的程序,利用文本框作数据的输入和输出
楼上太长了...
四个文本框,前三个输入,最后一个输出
一个按钮,按钮的单击响应代码如下:
Private Sub Command1_Click()
Dim pingjun As Double
pingjun = (Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text)) / 3
Text4.Text = pingjun
End Sub
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3120
ClientLeft = 60
ClientTop = 420
ClientWidth = 4680
全部展开
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3120
ClientLeft = 60
ClientTop = 420
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3120
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "退出"
Height = 465
Left = 3810
TabIndex = 10
Top = 2580
Width = 765
End
Begin VB.CommandButton Command2
Caption = "重填"
Height = 465
Left = 1620
TabIndex = 9
Top = 1770
Width = 765
End
Begin VB.CommandButton Command1
Caption = "计算"
Height = 465
Left = 2820
TabIndex = 8
Top = 1770
Width = 765
End
Begin VB.TextBox Text4
Alignment = 2 'Center
Height = 375
Left = 3420
TabIndex = 6
Top = 930
Width = 825
End
Begin VB.TextBox Text3
Alignment = 2 'Center
Height = 375
Left = 2070
TabIndex = 2
Top = 900
Width = 825
End
Begin VB.TextBox Text2
Alignment = 2 'Center
Height = 375
Left = 1170
TabIndex = 1
Top = 900
Width = 825
End
Begin VB.TextBox Text1
Alignment = 2 'Center
Height = 375
Left = 270
TabIndex = 0
Top = 900
Width = 825
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "平均成绩"
Height = 180
Left = 3450
TabIndex = 7
Top = 720
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "英语成绩"
Height = 180
Left = 2130
TabIndex = 5
Top = 690
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "数学成绩"
Height = 180
Left = 1230
TabIndex = 4
Top = 690
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "语文成绩"
Height = 180
Left = 330
TabIndex = 3
Top = 690
Width = 720
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Text4 = (Val((Val(Text1)) + (Val(Text2)) + (Val(Text3))) / 2)
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
End Sub
Private Sub Command3_Click()
End
End Sub
收起