常见VB考试题型_第1页
常见VB考试题型_第2页
常见VB考试题型_第3页
已阅读5页,还剩30页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1 输入半径 , 求圆面积和球体积。Private Sub Form_Load()Dim r As Single, s As Single, v As Single r = InputBox(" 请输入半径 r : ", " 输入数据 ")s = * r 人 2v = 4 / 3 * r A 3 *'Print "圆面积为 :" s'Print "球体积为 :" vMsgBox (" 圆面积为 :" & s & Space(2) & " 球体积为

2、 :" & v)End SubY 中。2 输入两个数存放在 x 和 y 中 ,比较大小,保证大数放在 x 中,小的数放在 Private Sub Command1_Click()Print " 比较前 :"X = InputBox(" 请输入 X")Y = InputBox(" 请输入 Y") Print "X=" X, "Y=" YIf X < Y Then Z = YY = XX = ZEnd IfPrint " 比较后 :"Print "

3、;X=" X, "Y=" YEnd Sub3 判断一个整数的奇偶性Private Sub Form_Click()x = Val(InputBox(" 请输入一个数 ;")If x Mod 2 = 0 ThenMsgBox (x & " 是偶数 ") ElseMsgBox (x & " 是奇数 ")End IfEnd Sub4 帐号和密码Private Sub Command1_Click()If = "12345" ThenIf = "12345"

4、 ThenMsgBox " 登录成功 ", 64 + 1, " 登录 "ElseMsgBox " 密码错误 , 请重新输入 ", 16End IfElseMsgBox " 用户不存在 ", 16 + 1, " 登录 "End IfEnd Sub5 判断一个数是整数还是小数,如果是整数再判断其奇偶性Private Sub Form_Click()x = InputBox(" 请输入一个数 ;")If InStr(1, x, ".") = 0 ThenIf x

5、 Mod 2 = 0 ThenMsgBox (x & "是整数 , 是偶数! ")ElseMsgBox (x & " 是整数 , 是奇数! ")End IfElseMsgBox (x & "是小数 ")End IfEnd Sub6 书店优惠售书Private Sub Command1_Click()Dim x As Single, y As Single x = ValSelect Case xCase Is <= 100 y = x *Case Is <= 200y = x *Case Is &l

6、t;= 300y = x *Case Elsey = x *End Select= y & " 元 "End Sub7 设计一个计程车收费程序Private Sub Command1_Click() X = ValSelect Case XCase Is <= 3= 6Case Is <= 30= 6 + (X - 3) *Case Else= 6 + 27 * + (X - 30) * 2End SelectEnd Sub8 输入 10 个数,输出累加之和。Private Sub Command1_Click()Dim S As Single, i A

7、s Integer, x As Single S = 0个数 ")个数 ")For i = 1 To 10x = Val(InputBox(" 请输入第 " & i & "Print " 第" & i & " 个数" & xS = S + xNext iPrint " 十个数累加之和为 " & S End Sub9 输入 10 个数,输出偶数之和。Private Sub Command1_Click()Dim S As Single, x

8、 As SingleDim n As Integer, i As IntegerS = 0For i = 1 To 10x = Val(InputBox(" 请输入第 " & i & "Print " 第" & i & " 个数" & xIf x Mod 2 = 0 ThenS = S + Val(x)End IfNext iPrint " 十个数中偶数累加之和为 " & S End Sub10 求 S=1+2+3+100Private Sub Comman

9、d1_Click()Dim I As Integer, S As LongS = 0For I = 1 To 100S = S + INext IPrint Tab(10); "S=" S End Sub11 求 S=1+3+5+99Private Sub Command1_Click() s = 0For i = 1 To 100 Step 2s = s + iNext iPrint "s=" sEnd Sub12 S=1+22+32+102,计算并输出 sPrivate Sub Command1_Click()s = 0For i = 1 To 10

10、s = s + i A 2Next iIIs=" sEnd Sub10000013 S=1+22+32+n2,问 n为多少时,s的值大于Private Sub Command1_Click()s = 0n = 0Do While s <= 100000n = n + 1s = s + n A 2LoopPrintPrintPrintPrintPrintPrint Tab(15); "n=" nEnd Sub14 1)S=1/2+1/4+1/6+1/8+1/10+ + 1/20,求 s 并输出 s 的值。 Private Sub Comma nd1_Click

11、()Dim s As Single, i As Integers = 0For i = 2 To 20 Step 2s = s + 1 / iNext iPrin t "s=" sEnd Sub15 s=1 x 2X 3X x 10求n! ,n为110之间的随机整数。Private Sub Comma nd1_Click()Dim s As Lon g, i As In tegers = 1Fori = 1 To 10s = s * iNext iPrin t "10!=" sEnd Sub16已知一数列的前两项均为1,从第3项开始,每一项的值为其前面两

12、项之和,求数列的前20项的和。Private Sub Comma nd1_Click()Dim s As In teger, f1 As In tegerDim f2 As In teger, f3 As In tegers = 0f1 = 1f2 = 1s = f1 + f2For i = 3 To 20f3 = f1 + f2s = s + f3f1 = f2f2 = f3Next iPrin t "s=" sEnd Sub17 S求其前20项和Private Sub Command1_Click()Dim s As Single, f1 As Integer, f2

13、As Integer Dim f3 As Integer, i As Integer s = 0 f1 = 1 f2 = 2For i = 1 To 20 s = s + f2 / f1 f3 = f2 f2 = f1 + f2 f1 = f3Next i Print "s=" sEnd Sub18 S=1!+2!+3!+10!Private Sub Command1_Click()Dim s As Long, s1 As Long, i As Integer, j As Integer s = 0For i = 1 To 10s1 = 1For j = 1 To is1

14、= s1 * jNexts = s + s1Next iPrintPrint "s=" sEnd Sub 考虑另一种算法 见其他打印部分19 s=1+(1+2)+(1+2+3)+ +(1+2+ 10)Private Sub Command1_Click()Dim s As Integer, s1 As IntegerDim i As Integer, j As Integers = 0For i = 1 To 10s1 = 0For j = 1 To is1 = s1 + jNext js = s + s1Next iPrint "s=" sEnd Su

15、b10A(-5)20 s=1-1/3!+1/5!-1/7!+直到某一项的绝对值小于Private Sub Command1_Click()Dim S As Single, S1 As SingleDim i As Integer, F As Integer, J As IntegerS = 0S1 = 1i = 1F = 1 ' 正负符号标志Do While 1 / S1 > 10 A (-5)S1 = 1J = 1Do While J <= iS1 = S1 * JJ = J + 1LoopS = S + 1 / S1 * Fi = i + 2F = -F ' 换

16、符号LoopPrintPrint "S=" S - 1 / S1, "I=" i'S = 0'x = 1'n = 1'Do While 1 / x >= 10 A (-5)'S = S + (1 / x) * (-1) A (n + 1)'x = x * (n * 2) * (2 * n + 1)'n = n + 1'Loop'Print "S=" SEnd Sub21 s=2+22+222+2222+22222+222222Private Sub Comm

17、and1_Click()Dim s As Long, s1 As Long, i As Integer, j As Integer s = 0For i = 1 To 6s1 = 0For j = 1 To isi = si + 2 * 10 A (j - 1)Nexts = s + s1NextPrint "s=" sEnd Sub22 S=a+aa+aaa+aaaa ( N个a)其中a是一个1 , 9的随机整数,N是一个5 , 10的随机整数。Private Sub Command1_Click()Dim a As Integer, n As IntegerDim s

18、As Long, s1 As Long, i As Integer, j As IntegerClsRandomizea = Int(9 * Rnd) + 1n = Int(6 * Rnd) + 5s = 0For i = 1 To ns1 = 0For j = 1 To is1 = s1 + a * 10 A (j - 1)Next js = s + s1Next iPrint " 当 a=" a, "n=" n; "时 "PrintPrint "s=" sEnd Sub23 S=1+12+123+1234+12

19、345+123456Private Sub Command1_Click()Dim s As Long, s1 As Long, i As Integer, j As Integers = 0s1 = 0For i = 1 To 6s1 = s1 * 10 + iPrint s1s = s + s1Next iPrint "s=" s's = 0'For i = 1 To 6' s1 = 0' For j = 1 To i'si = si + j * 10 A (i - j)' Next j' s = s + si&#

20、39;Next i'Print "s="sEnd Sub24 将一字符串逆序输出Private Sub Commandi_Click()Dim n As Integer, si As String, s2 As Stringsi = s2 = "" n = Len(Trim)For i = n To i Step -is2 = s2 & Mid(si, i, i)Next i = s2End Sub25 判断任给一大于 3 的整数是否是素数。 Private Sub Commandi_Click() Dim N As Integer, I

21、 As IntegerN = InputBox(" 请输入一个大于 3的整数")For I = 2 To N - iIf N Mod I = 0 ThenExit ForEnd IfNext IIf N = I ThenMsgBox (N & " 是素数 ")ElseMsgBox (N & " 不是素数 ")End IfEnd Sub26 输出 3i00 之间的素数 输出Private Sub Commandi_Click()Dim n As Integer, i As IntegerFor n = 3 To 100F

22、or i = 2 To n - 1If n Mod i = 0 ThenExit ForEnd IfNext iIf i = n ThenPrint nEnd IfNext nEnd Sub换行输出Private Sub Command2_Click()Dim n As Integer, i As IntegerDim m As Integerm = 0For n = 3 To 100For i = 2 To n - 1If n Mod i = 0 ThenExit ForEnd IfNext iIf i = n Thenm = m + 1If m Mod 5 = 0 ThenPrint nE

23、lsePrint n;End IfEnd IfNext nEnd Sub'Private Sub Command2_Click()'Dim n As Integer, i As Integer 'dim m as in'm = 0'For n = 3 To 100' For i = 2 To n - 1' If n Mod i = 0 Then' Exit For' End If' Next i' If i = n Then' m = m + 1' If m Mod 5 = 0 Then&#

24、39; Print Tab(6 * m); n' m = 0' Else' Print Tab(6 * m); n;' End If' End If'Next n'End Sub27 输出 100999 之间的水仙花数 Private Sub Command1_Click() Dim I As Integer, A As Integer Dim B As Integer, C As Integer For I = 100 To 999A = Int(I / 100)B = Int(I / 10) - A * 10C = I - A * 1

25、00 - B * 10If A A 3 + B A 3 + C A 3 = I The nI;End IfNext IEnd Sub28陈婷的QQ密码是一个5位数。但因为有一段比较长的日子没上了,陈婷把这个密码给忘了。不过陈婷的生日是 8月1日, 她妈妈的生日是 9月1日, 她特别喜欢把同时是 8l 和 9l 的倍数用作密码。 陈婷还记得这个密码的中间一位 (百位数 )是 l 。你能设计一个程序帮她找 回这个密码吗Private Sub Command1_Click()' 陈婷密码: 5位数,能被 81, 91 整除,百位是 1Dim i As Long, x As IntegerFo

26、r i = 10100 To 99199x = i 100 Mod 10If x = 1 ThenIf i Mod 91 = 0 And i Mod 81 = 0 ThenMsgBox " 密码是 " & iEnd IfEnd IfNext iEnd Sub29 百元买百鸡问题。假定小鸡每只 5 角,公鸡每只 2 元,母鸡每只 3 元。现在有 100 元 钱要求买 100 只鸡(每种鸡至少一只) ,编程列出所有可能的购鸡方案Option ExplicitPrivate Sub Command1_Click()Dim X As Integer, Y As Intege

27、rDim z As Integer, I As IntegerI = 0For X = 1 To 100For Y = 1 To 50For z = 1 To 33 If X + Y + z = 100 And * X + 2 * Y + 3 * z = 100 ThenI = I + 1" 方案" & I & " : 小鸡 " & X & " 只," _ & " 公鸡 " & Y & " 只," & " 母鸡"

28、 & z & " 只。" End IfNext z, Y, XEnd Sub30 鸡兔合笼共 20 只, 脚 46只问鸡几只兔几只Private Sub Command1_Click()Dim x As Integer, y As IntegerFor x = 1 To 20For y = 1 To 20 - xIf x + y = 20 And 2 * x + 4 * y = 46 ThenPrint "鸡" & x & " 只 ", " 兔" & y & &quo

29、t; 只"End IfNext yNext xEnd Sub31 找出 100 之内的自然数对 。 ( 两数的和是某个自然数的平方,两数的差也是某数的平 方)Private Sub Command1_Click()For i = 1 To 99For j = i + 1 To 100If Int(Sqr(j - i) = Sqr(j - i) And Int(Sqr(j + i) = Sqr(j + i) ThenPrint i, jEnd IfNext jNext iEnd Sub32 找出 1000-9999 之间的玫瑰花数。Private Sub Command1_Click(

30、)Dim i As IntegerDim a1 As Integer, a2 As IntegerDim a3 As Integer, a4 As IntegerFor i = 1000 To 9999a1 = i 1000a2 = i 100 Mod 10a3 = i 10 Mod 10a4 = i Mod 10If al A 4 + a2 A 4 + a3 A 4 + a4 A 4 = i The nPrint iEnd IfNext iEnd Sub33 猴子吃桃子。小猴在某天摘桃若干个,当天吃掉一半多一个;第二天吃了剩下的桃子的 一半多一个;以后每天都吃尚存桃子的一半多一个,到第 7

31、天要吃时只剩下一个,问小猴 共摘下了多少个桃子Option ExplicitPrivate Sub Command1_Click()Dim X As Integer, I As IntegerX = 1For I = 6 To 1 Step -1X = (X + 1) * 2" 第" & I; " 天桃子数是 :" & X & " 个。" Next IEnd Sub34 瓜农有西瓜 1020 个,每天能卖掉前一天剩下的总数的一半还多两个,问多少天能卖完。 Option ExplicitPrivate Sub C

32、ommand1_Click() Dim X As Integer, I As IntegerX = 1020I = 0Do While X > 0X = X / 2 - 2I = I + 1Loop= " 第" & I & " 天能卖完 ."End Sub35 一球从 10 米高空落下 ,每次弹起高度为落下高度的 40%,求第 8 次落下,小球经历的路程。 Private Sub Command1_Click()Dim s As Single, h As Single, i As Integers = 10h = 10For i =

33、 2 To 8 h = h * s = s + h * 2Next i" 球第八次落下经历的路程是: " s; " 米"End Sub36 输入十个数,输出其中的最大数和最小数Private Sub Command1_Click()Dim x As Single, i As IntegerDim max As Single, min As Singlex = Val(InputBox(" 请输入第 1 个数 ")Print xmax = x: min = xFor i = 2 To 10x = Val(InputBox("请

34、输入第 " & i & " 个数")Print xIf x > max Thenmax = xElseIf x < min Then min = xEnd IfEnd IfNext iPrint "max=" max, "min=" minEnd Sub37 7 个裁判给选手打分 ,要求去掉最高分和最低分 ,求平均分。Option ExplicitPrivate Sub Command1_Click()Dim C(7), MAX, MIN, S, IMAX = 0MIN = 100For I =

35、1 To 7C(I) = Val(InputBox("请输入第 " & I & " 裁判的打分 ", " 输入 ", , 7000, 1000)"第 " & I & "个裁判的打分 :" & C(I)S = S + C(I)If C(I) > MAX ThenMAX = C(I)ElseIf C(I) < MIN ThenMIN = C(I)End IfEnd IfNext IS = (S - MAX - MIN) / 5" 最后得分

36、是 :" & SEnd Sub38 求 M,N 的最大公约数和最小公倍数 Private Sub Command1_Click() Dim m As Integer, n As Integer Dim i As Integer, mas As Integer Max = 1 m = Val n = ValIf m >= n Thenx = nElsex = mEnd IfFor i = 1 To xIf m Mod i = 0 And n Mod i = 0 Then Max = iEnd IfNext i= " 最大公约数是 " & Max

37、End SubPrivate Sub Command2_Click() Dim m As Integer, n As Integer Dim i As Integer, mas As Integer m = Valn = ValIf m >= n Thenx = mElsex = nEnd IfMax = xFor i = x To m * nIf x Mod i = 0 And x Mod i = 0 Then Min = iExit ForEnd IfNext i= " 最小公倍数是 " & MinEnd Sub39 统计 1100之间能被 3 整除和能被

38、 7整除的数各有多少个Private Sub Command1_Click()Dim i As Integer, m As Integer, n As Integerm = 0: n = 0For i = 1 To 100If i Mod 3 = 0 Then m = m + 1End IfIf i Mod 7 = 0 Thenn = n + 1End IfNext iPrint " 能被 3 整除的数有 " & m & " 个" & vbCrLf & " 能被 7 整除的数有 " & n &a

39、mp; " 个 " End Sub 40统计字符串中字母“ A”出现的次数 (不区分大小写)Option ExplicitPrivate Sub Command1_Click()Dim N As Integer, I As Integer, x As String N = 0x =For I = 1 To Len(x)If Mid(x, I, 1) = "A" Or Mid(x, I, 1) = "a" Then 'If UCase(Mid(x, I, 1) = "A" ThenN = N + 1End I

40、f Next I = NEnd Sub41统计字符串中大写字母、小写字母、数字字符的个数分别是多少Private Sub Comma nd1_Click()Dim N1, N2, N3, IN1 = 0: N2 = 0: N3 = 0For I = 1 To LenX = Mid, I, 1)Select Case XCase "A" To "Z"N1 = N1 + 1Case "a" To "z"N2 = N2 + 1Case 0 To 9N3 = N3 + 1End SelectNext"大写字母个数

41、:"N1"小写字母个数:"N2"数字字符个数:"N3End Sub42简单图形输出Private Sub Comma nd1_Click()Dim N As In teger, I As In tegerDim J As In teger, A As In teger N = ValFor I = 1 To NTab(10 - I);For J = 1 To 2 * I - 1Trim(Str(I);Next JPrintNext I'N = Val'For I = 1 To N' Tab(15 - I);' F

42、or J = 1 To 2 * I - 1' Chr(64 + I);' Next J 'Next IEnd Sub43输出一个5X 5矩阵,该矩阵主对角线元素为1,其余元素为0。Private Sub Command1_Click()Dim a(5, 5)For i = 1 To 5For j = 1 To 5If i = j Then a(i, j) = 1 Else a(i, j) = 0 End If Print a(i, j); Next j Print Next i End Sub44 随机产生 10 个 1100 之间的 整数,并按从小到大顺序输出。 Pr

43、ivate Sub Command1_Click()Dim a(10) As IntegerFor i = 1 To 10a(i) = Int(100 * Rnd() + 1Print a(i);Next iFor i = 1 To 9For j = 1 To 10 - iIf a(j) >= a(j + 1) Thent = a(j): a(j) = a(j + 1): a(j + 1) = tEnd IfNext jNext iPrintPrint " 排序后 "For i = 1 To 10Print a(i);Next iEnd Sub45求n x n矩阵每行

44、元素之和(n值由键盘输入,矩阵元素随机产生,范围在20-50之间。Private Sub Command1_Click()Dim a() As Integer, S As Integer n = Val(InputBox(" 请输入 n")ReDim a(n, n)For i = 1 To nS = 0For j = 1 To n a(i, j) = Int(31 * Rnd + 20) Print a(i, j);S = S + a(i, j)Next jPrint " 第" i; " 行元素之和: " SNext iEnd Sub

45、46 :输入 10 个同学 3 门课成绩,求每个同学的总分,并按总分从高到低顺序输出。(每个同学名次)Private Sub Command1_Click()Dim a(10, 5)Print " 成绩 1" Tab(6); " 成绩" Tab(12); " 成绩" Tab(18); " 总分" Tab(24); " 名 次"For i = 1 To 3 a(i, 4) = 0For j = 1 To 3a(i, j) = Val(InputBox("第" & i &

46、amp; " 个同学第 " & j & " 门成绩 ")a(i, 4) = a(i, 4) + a(i, j)Next jNext iFor i = 1 To 3 a(i, 5) = 1For j = 1 To 3If a(j, 4) > a(i, 4) Thena(i, 5) = a(i, 5) + 1End IfNext jNext iFor i = 1 To 3For j = 1 To 5Print Tab(j - 1) * 6); a(i, j); Next jPrintNext iEnd Sub47:出一个5X 5矩阵的每

47、行最大元素,及最大元素的下标值。该矩阵每个元素为1 ,100 之间的随机整数。Private Sub Command1_Click()RandomizeDim a(5, 5) As Integer, i As Integer, j As IntegerDim max As Integer, h As IntegerFor i = 1 To 5max = 0: h = 0For j = 1 To 5a(i, j) = Int(100 * Rnd + 1)Print Tab(4 * j); a(i, j);If a(i, j) > max Thenmax = a(i, j)h = jEnd

48、IfNext jPrint Tab(4 * j); "第" i; "行最大元素是 " max; " 是第" h; " 个元素"Next iEnd Sub48: Sub过程和Function过程的创建均可采用两种方法:1、直接在代码窗口输入过程的结构语句和过程语句 Private Sub Command1_Click()m = Val n = Val mn = m - n= jc(m) / jc(n) / jc(mn)End SubPrivate Function jc(x)s = 1For i = 1 To xs

49、= s * iNext i jc = sEnd FunctionPrivate Sub Command2_Click() IlliEnd Sub2、通过“工具”菜单中的添加“过程” 过程 1Private Sub Command1_Click() m = Val n = Val mn = m - nCall jc(m) m = sCall jc(n) n = sCall jc(mn) mn = s= m / n / mnEnd SubPrivate Sub jc(x)s = 1For i = 1 To x s = s * i' Print sNext iEnd SubPrivate S

50、ub Command2_Click() IlliEnd Sub过程 2Dim sPrivate Sub Command1_Click() m = Valn = Val mn = m - n Call jc(m) Call jc(n)Call jc(mn) mn = s = m / n / mnEnd SubPrivate Sub jc(x) s = 1For i = 1 To x s = s * i Next i x = s End SubPrivate Sub Command2_Click() IlliEnd Sub49: 编写一个求三角形面积的Function 过程Option Expli

51、citPrivate Sub Command1_Click() Dim A, B, CA = ValB = ValC = ValIf A + B > C And B + C > A And A + B > C Then" 三角形面积 :" & Format(JS(A, B, C), "")ElseMsgBox "A,B,C 不能构成三角形 , 请重新输入 !", 48, " Illi Illi IlliEnd IfEnd SubPrivate Function JS(A, B, C)Dim X, S

52、X = (A + B + C) / 2S = Sqr(X * (X - A) * (X - B) * (X - C) JS = SEnd FunctionPrivate Sub JS1(A, B, C)Dim X, SX = (A + B + C) / 2S = Sqr(X * (X - A) * (X - B) * (X - C)SEnd SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)If KeyAscii = 13 ThenElseIf Chr(KeyAscii) > "9" Or Chr(KeyAscii)

53、< "0" Then MsgBox " 请输入数字符号 ", 64, " 提示 " KeyAscii = 0End IfEnd IfEnd SubPrivate Sub Text2_KeyPress(KeyAscii As Integer)If KeyAscii = 13 ThenElseIf Chr(KeyAscii) > "9" Or Chr(KeyAscii) < "0" Then MsgBox " 请输入数字符号 ", 64, " 提示 &

54、quot; KeyAscii = 0End IfEnd IfEnd SubPrivate Sub Text3_KeyPress(KeyAscii As Integer)If KeyAscii = 13 ThenElseIf Chr(KeyAscii) > "9" Or Chr(KeyAscii) < "0" Then MsgBox " 请输入数字符号 ", 64, " 提示 " KeyAscii = 0End IfEnd IfEnd Sub50: Public Sub test( i As Intege

55、r)i = i + 1 End SubPrivate Sub Form_Click()Dim x As Integerx = 4Print x;Call test(x)Print xEnd SubPublic Sub test(ByVal i As Integer) i = i + 1 end subSub S2(A As Integer, ByVal B As Integer) A = 2 * AB = B + 2End SubPrivate Sub Command1_Click()X = 4Y = 4Call S2(X, Y)Print X + YEnd SubSub S2(A, ByVa

56、l B)A = 2 * AB = B + 2End Sub51: 在文本框中输入字符,通过单选按纽和复选框设置字体、字型 Option ExplicitPrivate Sub Check1_Click() If = 1 Then= TrueElse= FalseEnd IfEnd SubPrivate Sub Check2_Click()If = 1 Then= TrueElse= FalseEnd IfEnd SubPrivate Sub Check3_Click() 'If = 1 Then= Not'Else' = False'End IfEnd SubP

57、rivate Sub Optio n1_Click()="黑体“End SubPrivate Sub Optio n2_Click() ="楷体 _GB2312"End SubPrivate Sub Optio n3_Click()="宋体"End Sub52:Private Sub Optio n1_Click()=vbRedEnd SubPrivate Sub Optio n2_Click()=vbBlueEnd SubPrivate Sub Optio n3_Click()=vbGree nEnd SubPrivate Sub Optio

58、 n4_Click()=0End SubPrivate Sub Optio n5_Click()=2End SubPrivate Sub Optio n6_Click()=1End Sub54:Private Sub Optio n1_Click()MsgBox & ” 同学是 ” &End SubPrivate Sub Optio n2_Click()MsgBox & ” 同学是 ” &End SubPrivate Sub Optio n3_Click()MsgBox & ” 同学是 ” &End Sub55:Private Sub Comma

59、nd1_Click()Dim n As Integer, s As Strings = ""n = 0If = 1 Thens = s &n = n + 1End IfIf = 1 Thens = s & Space(2) &n = n + 1End IfIf = 1 Thens = s & Space(2) &n = n + 1End IfMsgBox (" 您选修了 " & s & ", 共" & n & " 门课 ")End Sub56:

60、 在组合框中选择字体, 在列表框中选择字号、 字型, 示例中的文字按选择的字体、 字号和字型设置其格式。Private Sub Combo1_Change()End SubPrivate Sub Combo1_Click()End SubPrivate Sub Combo1_KeyPress(KeyAscii As Integer)If KeyAscii = 13 ThenEnd IfEnd SubPrivate Sub List1_Click()End SubPrivate Sub List2_Click()Select CaseCase 0= vbRedCase 1=vbBlueCase 2=vbGree nCase 3=vbBlackEnd SelectEnd Sub在列表框中双

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论