vb编程题目
设计一个窗体,如下图,上方是一个计算题,下面有4个答案供选择,本题为单项选择.选择正确时显示”你答对了,真了不起”否则显示”你答错了,再来一次”额....现在已经进去了!...
设计一个窗体,如下图,上方是一个计算题,下面有4个答案供选择,本题为单项选择.选择正确时显示”你答对了,真了不起”否则显示”你答错了,再来一次”
额....现在已经进去了!不过不是编程,而是网络... 展开
额....现在已经进去了!不过不是编程,而是网络... 展开
1个回答
展开全部
建议楼主 别搞计算机这行
新建个工程把代码复制到窗体 直接运行就可以了
Private WithEvents Text1 As TextBox
Private WithEvents Label1 As Label
Private WithEvents Label2 As Label
Private WithEvents Label3 As Label
Private WithEvents Label4 As Label
Private WithEvents Label5 As Label
Private WithEvents command1 As CommandButton
Private Sub Form_Load()
'动态加载控件
Set Text1 = Controls.Add("VB.TextBox", "text1")
Set Label1 = Controls.Add("VB.Label", "Label1")
Set Label2 = Controls.Add("VB.Label", "Label2")
Set Label3 = Controls.Add("VB.Label", "Label3")
Set Label4 = Controls.Add("VB.Label", "Label4")
Set Label5 = Controls.Add("VB.Label", "Label5")
Set command1 = Controls.Add("VB.CommandButton", "Command1")
Label1.Caption = "1+1=?"
Label2.Caption = "a、1"
Label3.Caption = "b、2"
Label4.Caption = "c、3"
Label5.Caption = "d、4"
command1.Caption = "确定"
Text1.Visible = True
Label1.Visible = True
Label2.Visible = True
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
command1.Visible = True
Text1.Left = 1000
command1.Left = 3000
Label2.Top = 800: Label2.Left = 0
Label3.Top = 800: Label3.Left = 1300
Label4.Top = 800: Label4.Left = 2800
Label5.Top = 800: Label5.Left = 4000
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请输入答案"
ElseIf Text1.Text = "b" Then
MsgBox "回答正确"
Else
MsgBox "回答错误"
End If
End Sub
新建个工程把代码复制到窗体 直接运行就可以了
Private WithEvents Text1 As TextBox
Private WithEvents Label1 As Label
Private WithEvents Label2 As Label
Private WithEvents Label3 As Label
Private WithEvents Label4 As Label
Private WithEvents Label5 As Label
Private WithEvents command1 As CommandButton
Private Sub Form_Load()
'动态加载控件
Set Text1 = Controls.Add("VB.TextBox", "text1")
Set Label1 = Controls.Add("VB.Label", "Label1")
Set Label2 = Controls.Add("VB.Label", "Label2")
Set Label3 = Controls.Add("VB.Label", "Label3")
Set Label4 = Controls.Add("VB.Label", "Label4")
Set Label5 = Controls.Add("VB.Label", "Label5")
Set command1 = Controls.Add("VB.CommandButton", "Command1")
Label1.Caption = "1+1=?"
Label2.Caption = "a、1"
Label3.Caption = "b、2"
Label4.Caption = "c、3"
Label5.Caption = "d、4"
command1.Caption = "确定"
Text1.Visible = True
Label1.Visible = True
Label2.Visible = True
Label3.Visible = True
Label4.Visible = True
Label5.Visible = True
command1.Visible = True
Text1.Left = 1000
command1.Left = 3000
Label2.Top = 800: Label2.Left = 0
Label3.Top = 800: Label3.Left = 1300
Label4.Top = 800: Label4.Left = 2800
Label5.Top = 800: Label5.Left = 4000
End Sub
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请输入答案"
ElseIf Text1.Text = "b" Then
MsgBox "回答正确"
Else
MsgBox "回答错误"
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询