当前位置:首页 » 课程大全 » vb课程设计小程序

vb课程设计小程序

发布时间: 2021-02-26 01:31:45

⑴ 用VB设计一个小程序 随机数

Dim i%, Wei%, a#(1 To 100)
Randomize
For i = 1 To 100
Wei = Int(Rnd * 9 + 1)
Select Case Wei
Case Is = 1
a(i) = Int(Rnd * 10+1)
Case Is = 2
a(i) = Int(Rnd * 100+1)
Case Is = 3
a(i) = Int(Rnd * 1000+1)
Case Is = 4
a(i) = Int(Rnd * 10000+1)
Case Is = 5
a(i) = Int(Rnd * 100000+1)
Case Is = 6
a(i) = Int(Rnd * 1000000+1)
Case Is = 7
a(i) = Int(Rnd * 10000000+1)
Case Is = 8
a(i) = Int(Rnd * 100000000+1)
Case Is = 9
a(i) = Int(Rnd * 1000000000+1)
End Select
Next i

⑵ 用VB设计一个小程序,如图1所示

就是只加些控件咯?

⑶ vb小程序设计实例

使用access数据库,将所有题都事先输入在题库中,在软件运行过程中从题库中随即内抽取题目,输出到容窗体上!
比如试题表Question
可能会有的字段
字段 类型 备注
ID int 自增量
Content string 问题描述
Type byte 问题类型,1填空题,2选择题,3问答题
大概这些,可能根据出的问题不同有更详细字段
背景音乐你可以给窗体上放一个windows media player控件,设置为不可见,然后让这个控件放歌就可以了!

⑷ 用vb设计一个小程序要求如图

楼主你好

我是在VB 6.0的环境下做的

首先设置窗口控件,我直接上图

望采纳!~谢谢

⑸ 帮忙做简单《VB程序设计》课程设计

真不知道为什么书上会让你们去学Adodc这种垃圾控件....发布程序的时候带个累赘不说,用起来也不灵活....
自己用ado写个多简单啊....
唉....教育啊.....把些好学生都毁了

⑹ 求VB6.0入门图文教程 简单制作一个小程序的

与其说书本,可能还是网上的视频教程更适合你吧。
可上网搜一下。

⑺ vb课程设计,怎么做一个小球沿着正弦曲线运动的程序大神来~

改个txt复制后改名为Form1.frm
VERSION 5.00
Begin VB.Form Form1
AutoRedraw = -1 'True
Caption = "Form1"
ClientHeight = 4545
ClientLeft = 120
ClientTop = 450
ClientWidth = 6465
LinkTopic = "Form1"
ScaleHeight = 303
ScaleMode = 3 'Pixel
ScaleWidth = 431
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox TxtFle
Height = 270
Index = 1
Left = 3960
TabIndex = 3
Text = "2"
Top = 2520
Width = 735
End
Begin VB.TextBox TxtFle
Height = 270
Index = 0
Left = 1800
TabIndex = 2
Text = "0"
Top = 2520
Width = 735
End
Begin VB.HScrollBar HScroll1
Height = 375
Left = 2520
Max = 300
TabIndex = 1
Top = 2880
Width = 1335
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 30
Left = 1080
Tag = "0"
Top = 3360
End
Begin VB.CommandButton Command1
Caption = "开始"
Height = 375
Left = 600
TabIndex = 0
Top = 2880
Width = 855
End
Begin VB.Label Label3
Caption = "速度"
Height = 375
Left = 1800
TabIndex = 6
Top = 3000
Width = 615
End
Begin VB.Label Label2
Caption = "最大PI单位"
Height = 255
Left = 2640
TabIndex = 5
Top = 2520
Width = 1095
End
Begin VB.Label Label1
Caption = "最小PI单位"
Height = 255
Left = 600
TabIndex = 4
Top = 2520
Width = 1095
End
Begin VB.Shape Shape1
BackStyle = 1 'Opaque
Height = 255
Left = 2040
Shape = 3 'Circle
Top = 1560
Width = 135
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SpaceTop As Integer
Dim StepB As Double
Const PI = 3.1415926
Dim SFlag As Boolean
Dim MaxSpeed As Integer
Dim MaxFle As Double
Dim MinFle As Double
Dim Bl As Integer
Private Sub Command1_Click()
If Command1.Caption = "开始" Then
Timer1.Enabled = True
Command1.Caption = "停止"
Else
Timer1.Enabled = False
Command1.Caption = "开始"
End If
End Sub

Private Sub Form_Load()
Bl = 40
SpaceTop = 40
MaxFle = 2 * PI
MinFle = 0
StepB = PI / 100
MaxSpeed = 51
HScroll1.Max = MaxSpeed - 1
HScroll1.Min = 0
HScroll1.Value = 40
Timer1.Interval = MaxSpeed - HScroll1.Value
End Sub

Private Sub HScroll1_Change()
On Error Resume Next
Timer1.Interval = MaxSpeed - HScroll1.Value
End Sub

Private Sub Timer1_Timer()
Timer1.Enabled = False
Me.CurrentX = Timer1.Tag * Bl
Me.CurrentY = SpaceTop + Sin(Timer1.Tag) * Bl
Me.Print "."
If Timer1.Tag <= MaxFle And Timer1.Tag >= MinFle Then
Shape1.Left = Timer1.Tag * Bl - Shape1.Width / 2
Shape1.Top = SpaceTop + Sin(Timer1.Tag) * Bl - Shape1.Width / 2

If SFlag = False Then
Timer1.Tag = Timer1.Tag + StepB
Else
Timer1.Tag = Timer1.Tag - StepB
End If
Else
If SFlag = False Then
SFlag = True
Timer1.Tag = MaxFle
Else
SFlag = False
Timer1.Tag = MinFle
End If
End If
Timer1.Enabled = True
End Sub

Private Sub TxtFle_Change(Index As Integer)
MaxFle = Val(TxtFle(1)) * PI
MinFle = TxtFle(0) * PI
End Sub
其他的自己完善一下吧 下班喽

⑻ 用VB制作小程序

OptionExplicit

PrivateSubForm_Load()
Randomize
Label1.Caption=Int((Rnd*(999999-100000+1))+100000)'生成100000-999999之间的随机数
Timer1.Interval=1000'一秒一次
Timer1.Enabled=True

EndSub

PrivateSubTimer1_Timer()
StaticnAsInteger
n=n+1
Ifn=60Then'一秒一次,累加到60此即60秒
n=0
Randomize
Label1.Caption=Int((Rnd*(999999-100000+1))+100000)
EndIf
EndSub

有问题请追问,内满意请采纳,加油!容

⑼ VB设计一个简单的小程序

变量定义面变量名x,y换别x1y1等
Dim
x1
As
Integer
Private
Sub
Command1_Click()'+按钮内容
x1
=
x1
+
1
Me.Caption
=
x1
End
Sub
Private
Sub
Command2_Click()'-按钮
x1=
x1
-
1
Me.Caption
=
x1
End
Sub

⑽ Vb制作小程序

这个不难办到

你用一个新的模块将下面的代码放进去

Private Declare Function Process32First Lib "kernel32" (ByVal hSnapShot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function Process32Next Lib "kernel32" (ByVal hSnapShot As Long, lppe As PROCESSENTRY32) As Long
Private Declare Function CreateToolhelp32Snapshot Lib "kernel32" (ByVal dwFlags As Long, ByVal th32ProcessID As Long) As Long
Private Declare Function CloseHandle Lib "kernel32.dll" (ByVal hObject As Long) As Long
Private Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32MoleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szExeFile As String * 260
End Type
Private Const PROCESS_QUERY_INFORMATION = 1024
Private Const PROCESS_VM_READ = 16
Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Const TH32CS_SNAPPROCESS = &H2

Public Function TestProcIsRunning(ByVal ProcName As String) As Boolean
Dim hFindProc As Long
hFindProc = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)
Dim ProcData As PROCESSENTRY32
ProcData.dwSize = Len(ProcData)
Process32First hFindProc, ProcData
While (Process32Next(hFindProc, ProcData) = 1)
Dim sPro As String
sPro = Left(UCase(ProcData.szExeFile), InStr(UCase(ProcData.szExeFile), Chr(0)) - 1)
If sPro = UCase(ProcName) Then
CloseHandle hFindProc
TestProcIsRunning = True
Exit Function
End If
Wend
CloseHandle hFindProc
TestProcIsRunning = False
End Function

然后你用一个timer来实现判断就可以啦

Private Sub Timer1_Timer()
If TestProcIsRunning("你要判断的进程名") = True Then
Shell "调用这个程序的路径", vbHide ''' 你写双进程源码的时候最好要隐藏程序
End If
End Sub

你好,双进程我也写过,至于编译后运行很容易被360拦截掉的,不过用来练手也感觉不错..

热点内容
武汉大学学生会辅导员寄语 发布:2021-03-16 21:44:16 浏览:612
七年级学生作文辅导学案 发布:2021-03-16 21:42:09 浏览:1
不屑弟高考成绩 发布:2021-03-16 21:40:59 浏览:754
大学毕业证会有成绩单 发布:2021-03-16 21:40:07 浏览:756
2017信阳学院辅导员招聘名单 发布:2021-03-16 21:40:02 浏览:800
查询重庆2018中考成绩查询 发布:2021-03-16 21:39:58 浏览:21
结业考试成绩怎么查询 发布:2021-03-16 21:28:40 浏览:679
14中医医师资格笔试考试成绩查分 发布:2021-03-16 21:28:39 浏览:655
名著赏析课程标准 发布:2021-03-16 21:27:57 浏览:881
北京大学商业领袖高端培训课程 发布:2021-03-16 21:27:41 浏览:919