ImageVerifierCode 换一换
格式:DOCX , 页数:44 ,大小:1.66MB ,
资源ID:5507153      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5507153.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(全国计算机二级VB上机题库.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

全国计算机二级VB上机题库.docx

1、全国计算机二级VB上机题库 第一题Dim s As StringPrivate Sub Command1_Click() Open App.Path & in4.dat For Input As #1 s = Input(LOF(1), #1) Close #1 Text1.Text = sEnd SubPrivate Sub Command2_Click() Dim m As Integer If Len(s) = 0 Then MsgBox 请先使用“读数据”功能! Else If Text1. SelLength = 0 Then MsgBox 请先选中文本! Else t = For

2、i = 1 To Text1.SelLength c = Mid(Text1.SelText, i, 1) If c Then t = t + c Else x = t If InStr(x, o) 0 And InStr(x, n) 0 Then m = m + 1 End If t = End If Next i text2 = Str(m) End If End IfEnd Sub第二题Private Sub Command1_Click() Dim k As Integer Open App.Path & in5.dat For Input As #1 For k = 1 To 100

3、 Input #1, a(k) Text1 = Text1 + Str(a(k) + Space(2) Next k Close #1End SubPrivate Sub Command2_Click() Dim b(100) As Integer num = 0 If Len(Text1.Text) = 0 Then MsgBox 请先执行“读数据”功能! Else考生编写(功能:生成存放素数的数组 b ) 注意:请务必将数组 b 的元素个数存入变量 num 中num = 1 For i = 1 To 100 For j = 2 To Sqr(a(i) If a(i) Mod j = 0 T

4、hen Exit For End If Next j If j Sqr(a(i) Then b(num) = a(i) num = num + 1 End If Next i以下程序段将 b 数组的内容显示在Text2中 For i = 1 To num-1 Text2.Text = Text2.Text + Str(b(i) + Space(2) Next i End IfEnd SubPrivate Sub Form_Unload(Cancel As Integer) Open App.Path & out5.dat For Output As #1 Print #1, Text2.Tex

5、t Close #1End Sub第三题在控件上右击属性第四题Private Sub menu2_Click()menu1.Enabled = TrueEnd Sub第五题第一小题(1)Dim a(10) As IntegerPrivate Sub Form_Load() For i = 1 To 10 a(i) = Int(Rnd * 100) NextEnd SubPrivate Sub Command1_Click() x = a(1) y = a(1) For i = 2 To 10 If Option1.Value = True Then If a(i) x Then x = a(i

6、) End If ElseIf a(i) y Then y = a(i) End If Next i If Option1.Value = True Then Label2.Caption = x Else Label2.Caption = y End IfEnd Sub第二小题(2)Private Sub List1_DblClick() Call MoveItem(List1, List2)End SubPrivate Sub Command1_Click() Call MoveAllEnd SubPublic Sub MoveItem(L1 As ListBox, L2 As ListB

7、ox) L2.AddItem L1.Text L1.RemoveItem L1.ListIndexEnd SubPublic Sub MoveAll() For i = 0 To List1.ListCount - 1 List2.AddItem List1.List(i) NextEnd Sub第五题Dim a(7, 7) As IntegerPrivate Sub Form_Load() readEnd SubPublic Sub read() Open App.Path & Data5.txt For Input As #1 Do While Not EOF(1) For i = 1 T

8、o 7 For j = 1 To 7 Input #1, a(i, j) Next j Next i Loop Close #1End SubPublic Sub Save() Open App.Path & out5.txt For Output As #1 Print #1, lblFirst.Caption, lblSecond.Caption Close #1End SubPrivate Sub Command1_Click() Dim Sum As Long N = 7 Counter = 0 Sum = 0 =考生编写程序开始= For i = 1 To N For j = 1 T

9、o N If i = j Or i + j = 8 Then If a(i, j) Mod 3 = 0 Then Counter = Counter + 1 Sum = Sum + a(i, j) End If End If Next j Next i lblFirst.Caption = Counter lblSecond.Caption = Sum =考生编写程序结束= SaveEnd Sub第六题注意:时钟的interval属性设置为 300Dim flag As IntegerPrivate Sub Cmd_Click(Index As Integer) If Index = 2 Th

10、en End Else Image1.Picture = LoadPicture(yellow.ico) flag = Index Timer1.Enabled = True End IfEnd SubPrivate Sub Timer1_Timer() Select Case flag Case 0 Image1.Picture = LoadPicture(green.ico) Timer1.Enabled = False Case 1 Image1.Picture = LoadPicture(red.ico) Timer1.Enabled = False End SelectEnd Sub

11、第七题第八题Private Sub Form_Click()Label1.Visible = TrueEnd SubPrivate Sub Form_Load()Form1.Caption = 标签End Sub第九提Private Sub Command1_Click() Call ShowName(Command1)End SubPrivate Sub Label1_Click() Call ShowName(Label1)End SubPrivate Sub ShowName(c As Control) If TypeOf c Is CommandButton Then Label2.C

12、aption = 单击 & Command1.Caption End If第十题注意,时钟interval设置为500Private Sub Form_Load() Picture1(0).Left = 0 Picture1(0).Top = 100 For k = 1 To 7 Picture1(k).Visible = False NextEnd SubPrivate Sub Command1_Click() Timer1.Enabled = TrueEnd SubPrivate Sub Command2_Click() Timer1.Enabled = FalseEnd SubPriva

13、te Sub Timer1_Timer() Static i As Integer Picture1(i).Visible = False i = i + 1 If i = 7 Then i = 0 End If Picture1(i).Visible = TrueEnd Sub第十三题第十四题 第十五题第十六,七题Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)End SubPrivate Sub Text2_Change() If Check1.Value = 1 Then Text3.Pass

14、wordChar = Else Text3.PasswordChar = # End If Text3.Text = Text2.TextEnd SubPrivate Sub Command1_Click() Text1.Enabled = true Text1.SetFocusEnd SubPrivate Sub Command2_Click() If Text1.Enabled = False Then MsgBox 请先使用“输入密码”功能! Else If Text1 abc Then n = n + 1 If n = 3 Then MsgBox 三次密码输入错误,你无权进入本系统!

15、End Else MsgBox 第 + Str(n) + 次密码输入错误,请重试! Text1 = Text1.SetFocus End If Else Text1.Enabled = False Text1 = form1.Hide form2.Show End If End IfEnd SubForm2:Private Sub Command1_Click() Form2.Hide Form1.ShowEnd Sub第十八题Option Base 1Dim s As StringPrivate Sub Command1_Click() Open App.Path & in4.dat For

16、 Input As #1 s = Input(LOF(1), #1) Close #1 Text1.Text = sEnd SubPrivate Sub Command2_Click() Dim m As Integer If Len(s) = 0 Then MsgBox 请先使用“读数据”功能! Else If Text1.sellength = 0 Then MsgBox 请先选中文本! Else t = For i = 1 To Text1.SelLength c = Mid(Text1.SelText, i, 1) If c Then t = t + c Else If t = the

17、 Then m = m + 1 End If t = End If Next i text2 = Str(m) End If End IfEnd Sub第十九题Option Base 1Dim a(100) As Integer, num As IntegerPrivate Sub Command1_Click() Dim k As Integer Open App.Path & in5.dat For Input As #1 For k = 1 To 100 Input #1, a(k) Text1 = Text1 + Str(a(k) + Space(1) Next k Close #1E

18、nd SubPrivate Sub Command2_Click() Dim b(100) As Integer num = 0 If Len(Text1.Text) = 0 Then MsgBox 请先执行“读数据”功能! Else 考生编写(功能:生成 b 数组,且按从小到大顺序排序) 注意:请务必将数组 b 的元素个数存入变量 num 中 以下程序段将已排序的 b 数组显示在Text2中 For i = 1 To num Text2.Text = Text2.Text + Str(b(i) + Space(2) Next i End IfEnd SubPrivate Sub Form_U

19、nload(Cancel As Integer) Open App.Path & out5.dat For Output As #1 Print #1, Text2.Text Close #1End Sub第二十题第二十一题Private Sub Form_Click()n = InputBox(请输入, 等级考试, Basic)End Sub第二十二题Private Sub Command1_Click() Dim n As Integer Dim b As Integer Dim a(3) As Integer s = RTrim(Text1.Text) n = Len(Text1.Tex

20、t) For i = 1 To n b = a(Mid(s, i, 1) Select Case Asc Case 48 To 57 a(0) = a(0) + 1 Case 65 To 90 a(1) = a(1) + 1 Case 97 To 122 a(2) = a(2) + 1 End Select Next For i = 0 To 2 Label = a(i) NextEnd SubPrivate Sub remove(La As ListBox, Lb As ListBox) For i = 0 To la.listcount - 1 Lb.AddItem la. List(i)

21、 Next la.ClearEnd SubPrivate Sub Command1_Click() Call remove(List1, List2)End SubPrivate Sub Command2_Click() Call remove(List2, List1)End Sub第二十四题Dim a(10) As IntegerPublic Sub Save() Open App.Path & out5.txt For Output As #1 Print #1, Label4.Caption Close #1End SubPrivate Sub Command1_Click() Ope

22、n App.Path & Data5.txt For Input As #1 Do While Not eof(1) For i = 1 To 10 Input #1, a(i) s = s & a(i) Next i Loop Close #1 Label2.Caption = sEnd SubPrivate Sub Command2_Click()=以下考生编写程序开始=For i=1 to 9 For j =i+1 to 10 If a(i)a(j) then t=a(i) a(i)=a(j) a(j)=t end if next jnext i=考生编写程序结束= For i = 1

23、To 10 s = s & Str(a(i) Next i Label4.Caption = s SaveEnd Sub第二十五,六题Private Sub HScroll1_Change()End SubPrivate Sub Form_Load()End SubPrivate Sub List1_Click()HS.Width = List1.TextEnd Sub 第二十七题Private Sub Form_Load() Load meEnd SubPrivate Sub Option1_Click(Index As Integer) Dim n As Integer n = Val(T

24、ext1.Text) Select Case Index Case 0 Text2.Text = f1(n) Case 1 Text2.Text = f1(n + 2) End SelectEnd SubPublic Function f1(n As Integer) As Long Dim x As Long x = 1 For i = 1 To n x = x * iNext f1 = x End Function第二十八题Private Sub Form_Load() Open App.Path & in4.txt For Input As #1 Line Input #1, s Tex

25、t1.Text = s Close #1End SubPrivate Sub Command1_Click() Dim n As Integer s = Text1.Text s1 = RTrim(Text2.Text) Do p = InStr(s1, s) If p 0 Then n = n + 1 s = Mid(s, p + 1) Loop While p = 0 Label3.Caption = nEnd Sub第二十九题Private Function isprime(a As Integer) As Boolean Dim flag As Boolean flag = True b% = 2Do While b% = Int(a / 2) And flag If Int(a / b%) = a / b% Then flag = False Else b% = b% + 1 End If Loop isprime = flagEnd FunctionPrivate Sub C1_Click()Dim x As Integerx = 17999Do While x b(j) then T=b(i) B(i)=b(j

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1