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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

VB试验答案.docx

1、VB试验答案2-1 Private Sub CmdCalculate_Click() Dim L As Integer L = Val(TxtLength.Text) TxtArea.Text = Str(L * L) TxtGirth.Text = Str(4 * L)End SubPrivate Sub cmdClear_Click() TxtLength.Text = TxtArea.Text = TxtGirth.Text = TxtLength.SetFocusEnd SubPrivate Sub Form_Load()End Sub2-2 Private Sub CmdCalcul

2、ate_Click() Dim R As Integer Dim H As Integer R = Val(TxtR.Text) H = Val(TxtH.Text) TxtV.Text = Str(3.14 * R * R * H)End SubPrivate Sub cmdClear_Click() TxtR.Text = TxtH.Text = TxtV.Text = TxtR.SetFocusEnd SubPrivate Sub Label1_Click()End Sub2-3 Private Sub Cmdexit_Click()Unload MeFrmmain.ShowEnd Su

3、bPrivate Sub Form_Load()End Sub2-5 Private Sub Form_Load()Text1.Text = 本练习是采用文本框制作的一个简单编辑器,该编辑器可以输入多行文字,有水平滚动条和垂直滚动条。另外文本框的大小可随着窗体大小的改变而改变,并总是充满整个窗体 End SubPrivate Sub Form_Resize() Text1.Left = 0 Text1.Top = 0 Text1.Width = Form1.ScaleWidth Text1.Height = Form1.ScaleHeightEnd SubPrivate Sub Text1_C

4、hange()End Sub2-6 Private Sub Command1_Click() Text1.Text = Label1.CaptionEnd SubPrivate Sub Command2_Click() EndEnd SubPrivate Sub Text1_Change()End Sub2-7 Private Sub Command1_Click()Print Tab(5); *Print Tab(4); *Print Tab(3); *Print Tab(2); *End SubPrivate Sub Command2_Click()ClsEnd SubPrivate Su

5、b Command3_Click()Move 0, 0End SubPrivate Sub Form_Load()End Sub2-8 Private Sub Command1_Click() Text1 = 千里之行,始于足下 Text1.Left = Form1.Width - Text1.Width Text1.Top = 0 Command1.Enabled = False Text1.Visible = TrueEnd SubPrivate Sub Command2_Click() Text1.Visible = False Command1.Enabled = TrueEnd Su

6、bPrivate Sub Form_Load()End Sub3-1 Dim f As Single, c As SingleDim answer As IntegerPrivate Sub Cmdend_Click()Unload MeFrmmain.ShowEnd SubPrivate Sub Cmdhs_Click() f = Val(Txthua.Text) c = (f - 32) * 5 / 9 Txtshe.Text = Str$(c)End SubPrivate Sub Cmdsh_Click() c = Val(Txtshe.Text) If c = 0 Then Txthu

7、a.Text = 32 ElseIf c 0 Then f = (c * 9# / 5) + 32 Txthua.Text = Str$(f) Else answer = MsgBox(非法数据!, vbOKOnly + vbExclamation, 提示信息) If answer = vbOK Then Txtshe.Text = Txthua.Text = Txtshe.SetFocus End If End IfEnd SubPrivate Sub Label1_Click()End Sub3-2 Option ExplicitDim fs As IntegerPrivate Sub c

8、mdGreat_Click() Text1.Text = UCase(Text1.Text)End SubPrivate Sub cmdRecall_Click() Text2.Text = Len(Text1.Text)End SubPrivate Sub cmdSmall_Click() Text1.Text = LCase(Text1.Text)End SubPrivate Sub Form_Load()End Sub3-3 Private Sub Form_Click() Dim s1 As Single, s2 As Single, s3 As Single Dim str1 As

9、String, str2 As String Dim b1 As Boolean, b2 As Boolean, b3 As Boolean Dim n1 As Integer, n2 As Integer, n3 As Integer s1 = 18 4 * 4# 2 / 1.6 s2 = 25 3 Mod 3.2 * Int(2.5) str1 = UCase(Xyz) & 1234 & LCase(abC) b1 = 3 4 Or 5 4 b2 = True And False n1 = Int(-3.5) + Fix(3.5) + CInt(2.6) n2 = Len(Str(123)

10、 + Hello) s3 = Sgn(7 Mod 3 - 4) + 0.75 b3 = aeoplane = 1600 Then zgz = gz * (1 + 0.1) ElseIf gz = 1400 Then zgz = gz * (1 + 0.15) Else zgz = gz * (1 + 0.2) End If txtZGz = CStr(zgz)End SubPrivate Sub Command2_Click() txtGz = txtZGz = txtGz.SetFocusEnd Sub4-4 Option ExplicitPrivate Sub Command1_Click

11、() Dim t As Integer, y As Single t = Val(txtTime) If t 10 Then y = 30 ElseIf t 50 Then y = 30 + (t - 10) * 3 Else y = 30 + (t - 10) * 2.5 End If If y = 90 Then Text2.Text = A ElseIf cj = 80 Then Text2.Text = B ElseIf cj = 70 Then Text2.Text = C ElseIf cj = 60 Then Text2.Text = D ElseIf cj = 0 Then T

12、ext2.Text = E End IfEnd SubPrivate Sub Command2_Click()Text1.Text = Text2.Text = End SubPrivate Sub Command3_Click()EndEnd SubPrivate Sub Text1_LostFocus()If Not IsNumeric(Text1.Text) Or Val(Text1.Text) 0 ThenMsgBox 数据输入错误,重输Text1.Text = Text1.SetFocusEnd IfEnd Sub4-6 Option ExplicitPrivate Sub Form

13、_Load() Dim Y As Integer, m As Integer Dim d As Integer, w1 As Integer Dim Rq As Date Dim w2 As String Rq = Date Y = Year(Rq) m = Month(Rq) d = Day(Rq) w1 = Weekday(Rq) Select Case w1 Case 1 w2 = 日 Case 2 w2 = 一 Case 3 w2 = 二 Case 4 w2 = 三 Case 5 w2 = 四 Case 6 w2 = 五 Case 7 w2 = 六 End Select Label1.

14、Caption = 今天是 & Y & 年 & m & 月 & d & 日 & 星期 & w2End Sub4-7 Private Sub Command1_Click()Dim Y1 As Integer, M1 As IntegerDim flag As Boolean, D1 As Integer, S1 As StringY1 = Val(txtYear)M1 = Val(txtMonth)flag = (Y1 Mod 4 = 0 And Y1 Mod 100 0) Or Y1 Mod 400 = 0Select Case M1Case 1, 2, 3 D1 = 31: S1 = 一季

15、度 If M1 = 2 Then If flag Then D1 = 29 Else D1 = 28 End If End IfCase 4, 5, 6 D1 = 30: S1 = 二季度If M1 = 5 Then D1 = 31Case 7, 8, 9 D1 = 31: S1 = 三季度If M1 = 9 Then D1 = 30Case 10, 11, 12 D1 = 31: S1 = 四季度If M1 = 11 Then D1 = 30End SelectIf flag Then txtRun = 是闰年 Else txtRun = 不是闰年 End IftxtSea = S1txtD

16、ays = Str(D1)End SubPrivate Sub Command2_Click()txtYear = txtMonth = txtSea = txtRun = txtDays = End Sub4-8 Private Sub Cmdclear_Click() txta.Text = Txtb.Text = Txtc.Text = Txtx1.Text = Txtx2.Text = txta.SetFocusEnd SubPrivate Sub Cmdcup_Click() a = Val(txta.Text) b = Val(Txtb.Text) c = Val(Txtc.Tex

17、t) disc = b * b - 4 * a * c p = -b / (2 * a) q = Sqr(Abs(disc) / (2 * a) If disc = 0 Then Txtx1 = Format$(p + q, #0.#) Txtx2 = Format$(p - q, #0.#) Else Txtx1 = Str$(p) & + & Str$(q) & i Txtx2 = Str$(p) & - & Str$(q) & i End IfEnd SubPrivate Sub Cmdend_Click() EndEnd SubPrivate Sub txta_KeyPress(Key

18、Ascii As Integer)If KeyAscii = 13 Then If Not IsNumeric(txta.Text) Then MsgBox 数据非法,重输 txta.Text = txta.SetFocus Else Txtb.SetFocus End If End If End SubPrivate Sub Txtb_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then If Not IsNumeric(Txtb.Text) Then MsgBox 数据非法,重输 Txtb.Text = Txtb.SetFocus Else

19、Txtc.SetFocus End If End IfEnd SubPrivate Sub Txtc_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then If Not IsNumeric(Txtc.Text) Then MsgBox 数据非法,重输 Txtc.Text = Txtc.SetFocus Else Cmdcup.SetFocus End If End IfEnd Sub4-9 Private Sub Cmdclear_Click()txtm1 = txtm2 = txtm3 = Lblinfo.Caption = txtm1.Set

20、FocusEnd SubPrivate Sub Cmdsort_Click() Dim m1 As Integer, m2 As Integer, m3 As Integer m1 = Val(txtm1.Text) m2 = Val(txtm2.Text) m3 = Val(txtm3.Text) If (m1 + m2 + m3) 3 95 Or (m1 = 100 And m2 = 100 And m3 = 80) _ Or (m1 = 100 And m3 = 100 And m2 = 80) Or _ (m1 = 80 And m2 = 100 And m3 = 100) Then

21、Lblinfo.Caption = 此学生奖学金为一等奖 ElseIf (m1 + m2 + m3) 3 90 Or (m1 = 100 And m2 = 75 And m3 = 75) _ Or (m1 = 75 And m2 = 100 And m3 = 75) Or _ (m1 = 75 And m2 = 75 And m3 = 100) Then Lblinfo.Caption = 此学生奖学金为二等奖 ElseIf m1 = 70 And m2 = 70 And m3 = 70 Then Lblinfo.Caption = 此学生奖学金为三等奖 Else Lblinfo.Caption = 此学生无奖学金 End IfEnd SubPrivate Sub txtm1_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then If Not IsNumeric(txtm1) Then MsgBox 数据非法,重新输入, vbExclamation, 输入操作数1 txtm1.Text = txtm1.SetFocus Else txtm2.SetFocus End IfEnd IfEnd SubPrivate Sub txtm2_KeyPress(KeyAsc

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

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