唐嫣跟谁结婚了:[求助]VB的编程题

来源:百度文库 编辑:高考问答 时间:2024/04/29 18:17:02
1.在Command1_click()事件中编写程序实现产生10个10—100之间的随机数;

2.在Command2_click()事件中编写程序求出其中的最大数,并在文本框Text1中显示出来。

3. 编写程序实现驱动器列表框、目录列表框及文件列表框三者协同工作的情况。

4.编写程序求 1!+2!+3!+4!+5!+6!+7!+8!,并把结果在文本框text1中显示出来

5.编写一程序,要求在文本框中输出200~400之间不能被3整除的数。

6.编写一程序,显示所有100以内6的倍数的数,并求这些数的和。

老师布置的作业,可系偶不会写啊
求求各位高手啦

'注意:第一题和第二题必须一起用.因为要传递一个存放随机数的数组
dim num(9) as long
'1.
private sub command1_click()
for i = 0 to 9
num(i) = int((rnd*90)+10)
print num(i)
next
end sub
'2.
private sub command2_click()
dim max as long
max = num(0)
for i =1 to 9
if num(i) > max then max=num(i)
next
text1.text=max
end sub
================================
3.
添加3个控件
drivelistBox:drive1
dirListBox:dir1
FileListBox:file1

'选择目录
private sub dir1_change()
file1.path = dir1.path
end sub

'选择驱动器
private sub drive1_change()
dir1.path = drive1.drive
end sub

4.添加一个command button
一个textbox
private sub command1_click()
v = 1
For a = 1 To 8
For b = 1 To a
v = b * v
Next b
vv = vv + v
v = 1
Next a
text1.text=vv
End Sub

5,添加一个command button
一个textbox
private sub command1_click()
for i = 200 to 400
if i mod 3 <> 0 then
text1.text=text1.text & i &","
end if
next
end sub

6,添加一个command button
两个textbox
private sub command1_click()
for i = 0 to 100
if i mod 6 = 0 then
text1.text = text1.text & i & ","
num = num +i
end if
next
text2.text = num
end sub