使用access数据库,将所有题都事先输入在题库中,在软件运行过程中从题库中随即抽取题目,输出到窗体上!
比如试题表Question
可能会有的字段
字段 类型 备注
ID int 自增量
Content string 问题描述
Type byte 问题类型,1填空题,2选择题,3问答题
大概这些,可能根据出的问题不同有更详细字段
背景音乐你可以给窗体上放一个windows media player控件,设置为不可见,然后让这个控件放歌就可以了!
假设文本框名称为Text1,单选按钮“宋体”名称为Option1,单选按钮“黑体”名称为Option2,复选框“下划线”名称为Check1,复选框“斜体”名称为Check2按钮的单击代码如下:
If Option1Value=True Then
Text1Fontname=“宋体"
else
Text1Fontname=“黑体"
End If
If Check1Value=1 Then
Text1FontUnderline =True
else
Text1FontUnderline =False
endif
if Check2Value=true then
Text1FontItalic = True
else
Text1FontItalic =False
endif
'//请将以下的文件保存为一个Form1frm文件,这样你就可以在VB6中运行了,正是你想要的程序。
VERSION 500
Begin VBForm Form1
Caption = "登陆"
ClientHeight = 2190
ClientLeft = 60
ClientTop = 345
ClientWidth = 4635
LinkTopic = "Form1"
ScaleHeight = 2190
ScaleWidth = 4635
StartUpPosition = 3 '窗口缺省
Begin VBTextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = ""
TabIndex = 1
Top = 600
Width = 1935
End
Begin VBTextBox Text1
Height = 375
Left = 1560
TabIndex = 0
Text = "SYL"
Top = 120
Width = 1935
End
Begin VBCommandButton Command2
Caption = "登陆"
Default = -1 'True
Height = 495
Left = 1560
TabIndex = 2
Top = 1320
Width = 1215
End
Begin VBCommandButton Command1
Caption = "退出"
Height = 495
Left = 3000
TabIndex = 3
Top = 1320
Width = 1215
End
Begin VBLabel Label2
AutoSize = -1 'True
Caption = "口令"
Height = 180
Left = 480
TabIndex = 5
Top = 840
Width = 360
End
Begin VBLabel Label1
AutoSize = -1 'True
Caption = "用户名"
Height = 180
Left = 480
TabIndex = 4
Top = 240
Width = 540
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()
Unload Me
End Sub
Private Sub Command2_Click()
If Text1Text = "SYL" And Text2Text = "123456" Then
MsgBox "欢迎登录", vbInformation
Else
MsgBox "不正确的用户名或密码", 16
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyUp
Shape1Top = Val(Shape1Top) - 200
Case vbKeyDown
Shape1Top = Val(Shape1Top) + 200
Case vbKeyLeft
Shape1Left = Val(Shape1Left) - 200
Case vbKeyUp
Shape1Left = Val(Shape1Left) + 200
End Select
End Sub
Private Sub Form_Click()
Dim sum1 As Long, sum2 As Long, sum3 As Long, j As Long, n As Long
For j = 1 To 100
sum1 = sum1 + j
If j Mod 2 = 0 Then
sum3 = sum3 + j
Else
sum2 = sum2 + j
End If
Next
MeCls
Print "整数和:"; sum1
Print "奇数和:"; sum2
Print "偶数和:"; sum3
End Sub
Private Sub Command1_Click()
If Text1Text <> "" Then
a = Val(Text1Text)
Else
a = -Val(Text2Text)
End If
If Text3Text <> "" Then
b = Val(Text3Text)
Else
b = -Val(Text4Text)
End If
c = Abs(a - b)
If c > 180 Then c = 360 - c
Text5Text = c 2 31415926 6378137 / 360
End Sub
求采纳为满意回答。
以上就是关于vb小程序设计实例全部的内容,包括:vb小程序设计实例、VB 程序设计 我要详细的程序。谢谢、有关VB语言程序设计等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)