Private Sub Command1_Click()
Dim t As Integer, m As Single
Do
t = Val(InputBox("输入上网时间,-1为停止"))
If t = -1 Then Exit Do
Select Case t
Case Is <= 10
m = 25
Case 10 To 50
m = 25 + (t - 10) 2
Case 50 To 100
m = 25 + (t - 10) 15
Case Else
m = 25 + (t - 10) 1
End Select
If m > 300 Then m = 300
MsgBox "上网费用=" & Round(m, 2) & "元"
Loop
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
-------------------------------
Private Sub Command1_Click()
Dim a(20) As Integer, max, min, avg, b(4) As Integer
For i = 1 To 20
a(i) = Int(Rnd 101)
Print a(i);
If i = 10 Then Print
If i = 1 Then max = a(1): min = a(1)
If max < a(i) Then max = a(i)
If min > a(i) Then min = a(i)
avg = avg + a(i)
Select Case a(i)
Case 0 To 59
b(0) = b(0) + 1
Case 60 To 69
b(1) = b(1) + 1
Case 70 To 79
b(2) = b(2) + 1
Case 80 To 89
b(3) = b(3) + 1
Case 90 To 100
b(4) = b(4) + 1
End Select
Next
Print "最高分:"; max
Print "最低分:"; min
Print "平均分:"; Round(avg / 20, 2)
Print "0~59分数段人数:"; b(0)
Print "60~69分数段人数:"; b(1)
Print "70~79分数段人数:"; b(2)
Print "80~89分数段人数:"; b(3)
Print "90~100分数段人数:"; b(4)
Call paixu(a)
For i = 1 To 20
Print a(i);
If i = 10 Then Print
Next
End Sub
Private Sub paixu(arr() As Integer)
For i = LBound(arr) To UBound(arr)
For j = LBound(arr) To i
If arr(i) < arr(j) Then t = arr(i): arr(i) = arr(j): arr(j) = t
Next
Next
End Sub
使用access数据库,将所有题都事先输入在题库中,在软件运行过程中从题库中随即抽取题目,输出到窗体上!
比如试题表Question
可能会有的字段
字段 类型 备注
ID int 自增量
Content string 问题描述
Type byte 问题类型,1填空题,2选择题,3问答题
大概这些,可能根据出的问题不同有更详细字段
背景音乐你可以给窗体上放一个windows media player控件,设置为不可见,然后让这个控件放歌就可以了!
首先在窗体上新建时间和你那小汽车的控件,在我的代码里,小汽车的控件名称为label1
然后设置时间控件的时间间隔属性为100即01秒,把可编辑属性调为false
然后在代码区域打上以下的代码,
Private Sub Command1_Click()
Timer1Enabled = True
End Sub
Private Sub Command2_Click()
Timer1Enabled = False
End Sub
Private Sub Timer1_Timer()
Label1Left = Label1Left + 20
End Sub
先在VB里加2个list控件,属性sorted设置为true,然后在list选项中打入你要的科目
Private Sub List1_Click()
List2AddItem List1List(List1ListIndex)
List1RemoveItem List1ListIndex
If List2ListCount >= 5 Then
MsgBox ("超过5门,不能再选")
End If
End Sub
Begin VBForm Form1
Caption = "Form1"
ClientHeight = 3150
ClientLeft = 1155
ClientTop = 1530
ClientWidth = 4215
LinkTopic = "Form1"
ScaleHeight = 3150
ScaleWidth = 4215
Begin VBCommandButton Command2
Caption = "退出"
Height = 495
Left = 960
TabIndex = 4
Top = 2400
Width = 2775
End
Begin VBCommandButton Command1
Caption = "处理"
Height = 735
Left = 2640
TabIndex = 3
Top = 240
Width = 1095
End
Begin VBTextBox Text3
Height = 1215
Left = 960
TabIndex = 2
Top = 1080
Width = 2775
End
Begin VBTextBox Text2
Height = 270
Left = 960
TabIndex = 1
Top = 600
Width = 1575
End
Begin VBTextBox Text1
Height = 270
Left = 960
TabIndex = 0
Top = 240
Width = 1575
End
Begin VBLabel Label3
Caption = "结果"
Height = 375
Left = 360
TabIndex = 7
Top = 1080
Width = 375
End
Begin VBLabel Label2
Caption = "字符2"
Height = 255
Left = 360
TabIndex = 6
Top = 600
Width = 495
End
Begin VBLabel Label1
Caption = "字符1"
Height = 255
Left = 360
TabIndex = 5
Top = 240
Width = 495
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()
Text3Text = Text1Text & " " & Text2Text
End Sub
Private Sub Command2_Click()
End
End Sub
以上就是关于VB程序设计,急求,在线等全部的内容,包括:VB程序设计,急求,在线等、vb小程序设计实例、VB程序设计等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)