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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

级《计算机基础实验VB》期末考试代码.docx

1、级计算机基础实验VB期末考试代码1、Private Sub Command1_Click()a = Label1.Captionb = aLabel1.Caption = Text1.TextText1.Text = bEnd SubPrivate Sub Form_Load()Command1.Caption = 修改Label1.Caption = 标签框Text1.Text = 文本框 End Sub2 、Private Sub Command1_Click()a = Val(Text1.Text) b = Val(Text2.Text) x = -b / a Text3.Text =

2、xEnd SubPrivate Sub Command2_Click()Text1.Text = Text2.Text = Text3.Text = End Sub3、Private Sub Form_Load()a = 此项操作正确吗?b = MsgBox(a, 36, 考试)If b = vbYes ThenMsgBox 结果正确, , 考试EndElsec = MsgBox(重新操作, 48, 考试)If c = vbOK Then b = MsgBox(a, 36, 考试)End IfEnd Sub4 、 Private Sub Command1_Click()Command1.Cap

3、tion = Text1.TextLabel1.Caption = Text1.TextEnd Sub5、Private Sub Command1_Click()Text4.Text = Val(Text1.Text) * Val(Text2.Text) * Val(Text3.Text)End SubPrivate Sub Command2_Click()Text1.Text = Text2.Text = Text3.Text = Text4.Text = End Sub6、Private Sub Command1_Click()a = UCase(Text1.Text) 大写Text1.T

4、ext = aEnd SubPrivate Sub Command2_Click()b = LCase(Text1.Text) 小写Text1.Text = bEnd SubPrivate Sub Command3_Click()EndEnd Sub7、Private Sub Form_Click()Dim i As Integer, sum As Integersum = 0For i = 100 To 200If (i Mod 2) = 1) And (i Mod 3) 0) ThenPrint isum = sum + iEnd IfNext iPrint sumEnd Sub8、Pri

5、vate Sub Form_Click()Dim s As LongDim n As Integers = 1n = 1While s = 400000n = n + 1s = s * nWendPrint n - 1End Sub9、 窗口1 Private Sub Form_click()Form1.Visible = FalseForm2.ShowEnd Sub窗口2Private Sub Command1_Click()EndEnd SubPrivate Sub Form_click()Form1.Visible = TrueEnd Sub10Private Sub Form_clic

6、k()Dim i As Integer, j As IntegerMe.AutoRedraw = TruePrint Tab(20); 九九乘法表PrintPrint ;For i = 1 To 9Print Tab(i * 5); i;NextPrintFor i = 1 To 9Print i;For j = 1 To iPrint Tab(j * 5); i * j;Next jPrintNext iEnd Sub难度:中(11-20)11.Private Sub Command1_Click()If Option1.Value Then Text1.FontName = 宋体If Op

7、tion2.Value Then Text1.FontName = 黑体If Option3.Value Then Text1.FontSize = 8If Option4.Value Then Text1.FontSize = 14End SubPrivate Sub Command2_Click()EndEnd Sub12、Option ExplicitPrivate Sub Command1_Click()If List1.Selected(0) ThenText1.Text = A地End IfIf List1.Selected(1) ThenText1.Text = B地End If

8、If List1.Selected(2) ThenText1.Text = C地End IfIf List1.Selected(3) ThenText1.Text = D地End IfIf List1.Selected(4) ThenText1.Text = E地End IfIf List1.Selected(5) ThenText1.Text = F地End IfIf List1.Selected(6) ThenText1.Text = G地End IfIf List1.Selected(7) ThenText1.Text = H地End IfEnd SubPrivate Sub Form_

9、Load()List1.AddItem 张一List1.AddItem 张二List1.AddItem 张三List1.AddItem 张四List1.AddItem 张五List1.AddItem 张六List1.AddItem 张七List1.AddItem 张八End SubPrivate Sub List1_DblClick()If List1.Selected(0) ThenText1.Text = A地End IfIf List1.Selected(1) ThenText1.Text = B地End IfIf List1.Selected(2) ThenText1.Text = C

10、地End IfIf List1.Selected(3) ThenText1.Text = D地End IfIf List1.Selected(4) ThenText1.Text = E地End IfIf List1.Selected(5) ThenText1.Text = F地End IfIf List1.Selected(6) ThenText1.Text = G地End IfIf List1.Selected(7) ThenText1.Text = H地End IfEnd Sub13、Private Sub Command1_Click()Dim i%If Text2.Text pass

11、Theni = MsgBox(密码错误, 5 + 16, 输入密码)If i = 2 ThenEndElseText2.Text = End IfElseMsgBox 输入正确, , 输入密码End IfEnd SubPrivate Sub Command2_Click()EndEnd SubPrivate Sub Form_Load()Text1.Text = Text2.Text = Text1.MaxLength = 6Text2.MaxLength = 4Text2.PasswordChar = *End SubPrivate Sub Text1_LostFocus()If Not I

12、sNumeric(Text1.Text) ThenMsgBox 账号必须为数字, 64, 提示Text1.Text = End IfEnd Sub14、Label1 显示颜色HScroll1 ,HScroll2,HScroll3 3个滚动条Label2, Label3, Label4 显示滚动条的值Private Sub Form_Load() HScroll1(0).Min = 0: HScroll1(1).Min = 0: HScroll1(2).Min = 0 HScroll1(0).Max = 255: HScroll1(1).Max = 255: HScroll1(2).Max =

13、255 Label2(0).Caption = CStr(HScroll1(0).Value) Label2(1).Caption = CStr(HScroll1(1).Value) Label2(2).Caption = CStr(HScroll1(2).Value) Label1.BackColor = RGB(HScroll1(0).Value, HScroll1(1).Value, HScroll1(2).Value)End SubPrivate Sub HScroll1_Change(Index As Integer) If Index = 0 Then Label2(0).Capt

14、ion = CStr(HScroll1(0).Value) Label1.BackColor = RGB(HScroll1(0).Value, HScroll1(1).Value, HScroll1(2).Value) End If If Index = 1 Then Label2(1).Caption = CStr(HScroll1(1).Value) Label1.BackColor = RGB(HScroll1(0).Value, HScroll1(1).Value, HScroll1(2).Value) End If If Index = 2 Then Label2(2).Captio

15、n = CStr(HScroll1(2).Value) Label1.BackColor = RGB(HScroll1(0).Value, HScroll1(1).Value, HScroll1(2).Value) End If End Sub15、平均成绩计算输入N个学生的成绩,求其平均分并找出低于平均成绩学生的学号、成绩。16、Private Sub command1_Click()Dim a, b, c As SingleDim t, s As Singlea = Val(Text1.Text)b = Val(Text2.Text)c = Val(Text3.Text)If (a + b

16、) c And (b + c) a And (c + a) b Thent = (a + b + c) / 2s = Math.Sqr(t * (t - a) * (t - b) * (t - c)Text4.Text = Str(s)ElseMsgBox 不能构成三角形, 64, 提示Text1.Text = : Text2.Text = : Text3.Text = End IfEnd SubPrivate Sub Command2_Click()EndEnd Sub17、设计一个简单的四则运算器。18、Private Sub Command1_Click()Command1.Visibl

17、e = FalseCommand2.Visible = TrueTimer1.Enabled = FalseTimer2.Enabled = TrueDim s As DateDim bs As Strings = NowSelect Case Hour(s)Case Is 8bs = 凌晨Case Is 12bs = 上午Case Is 14bs = 中午Case Is = a) Then Mid(t, i, 1) = Chr(Asc(Mid(t, i, 1) - Asc(a) + Asc(A)F = FalseElseIf Mid(t, i, 1) = ? Or Mid(t, i, 1)

18、= . Or Mid(t, i, 1) = ! ThenF = TrueEnd IfNext iText2.Text = tEnd Sub22、Private Sub Command1_Click()Dim arr(26) As Integers = Text1.Textn = Len(s)For i = 1 To nx = UCase(Mid(s, i, 1)If x = A And x = Z Then arr(Asc(x) - 64) = arr(Asc(x) - 64) + 1Next iFor i = 1 To 26Text2.Text = Text2.Text & Chr$(i +

19、 64) & = & arr(i) & Next iEnd Sub两个文本框 multiline 值设置为true 实验课本本 10823、Private Sub Picture1_Click()Dim stu_score(10) As IntegerDim stu_no(10) As IntegerRandomizePicture1.Print 学号 成绩Picture2.Print 学号 成绩For i = 1 To 10stu_no(i) = istu_score(i) = Int(Rnd * (100 - 30 + 1) + 30)Picture1.Print stu_no(i); ;

20、 stu_score(i)Next iPrintFor i = 1 To 10For j = 1 To 10 - iIf stu_score(j) stu_score(j + 1) Thent1 = stu_score(j)stu_score(j) = stu_score(j + 1)stu_score(j + 1) = t1t2 = stu_no(j)stu_no(j) = stu_no(j + 1)stu_no(j + 1) = t2End IfNext jNext iFor i = 1 To 10Picture2.Print stu_no(i); ; stu_score(i)Next i

21、End Sub24、Dim i%, j%, sum%Private Sub Command1_Click() For i = 3 To 1000 sum = 0 For j = 1 To i / 2 If i Mod j = 0 Then sum = sum + j End If Next If sum = i Then Print i; 因子是:; For j = 1 To i / 2 If i Mod j = 0 Then Print j; End If Next Print End If NextEnd Sub25、实验课本104(3)Private Sub Command1_Click

22、()List1.AddItem Text1Text1 = End SubPrivate Sub Command2_Click()List1.RemoveItem List1.ListIndexEnd SubPrivate Sub Command3_Click()Text1 = List1.TextText1.SetFocusCommand1.Enabled = FalseCommand2.Enabled = FalseCommand3.Enabled = FalseCommand3.Enabled = TrueEnd SubPrivate Sub Command4_Click()List1.L

23、ist(List1.ListIndex) = Text1Command4.Enabled = FalseCommand1.Enabled = TrueCommand2.Enabled = TrueCommand3.Enabled = TrueText1 = End SubPrivate Sub Form_Load()List1.AddItem 计算机文化基础List1.AddItem VB6.0程序设计教程List1.AddItem 操作系统List1.AddItem 多媒体技术List1.AddItem 网络技术基础End Sub26、Private Sub Command1_Click()

24、n = Text1.Textr = Trim(n)If r = StrReverse(r) ThenMsgBox 是回文数, , 判断ElseMsgBox 不是回文数, , 判断End IfEnd Sub27、Private Sub Command1_Click()Dim a As Single, sum As SingleDim i As Integersum = 0If Text1.Text = Then MsgBox 请输入n值 Exit SubElse If IsNumeric(Trim(Text1.Text) Then If Val(Text1.Text) = 0 Then MsgB

25、ox 请输入正整数 Exit Sub Else For i = 1 To Val(Text1.Text) a = 1 / i sum = sum + a Next i End If Else MsgBox 请输入正整数 Exit Sub End IfEnd IfPrint Val(Text1.Text) & 项的和为: & Format(sum, #.#)End Sub28、Private Sub Command1_Click()Dim sw As Single, range As SingleIf Text1.Text = Then MsgBox no input Exit SubElse If IsNumeric(Trim(Text1.Text) Then If Val(Text1.Text) = 0 Then MsgBox lower than zero Exit Sub Else If Val(Text1.Text) = 166 And Val(Text1.Text) = 175 Then sw = Val(Text1.Text) - 105 ElseIf Val(Tex

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

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