- 1、本文档共6页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
VB实验答案 简明版本
实验11
Private Sub Command1_Click()Label3.Caption = Text1.TextEnd Sub
?
实验12
Private Sub Form_Click()Text1.Text = Text1.Text + 1End Sub
Text1的初始值设为0,Label1的Autosize属性设为True
?
实验13
Private Sub Command1_Click()Text1.FontName = 隶书Text1.FontSize = 25End SubPrivate Sub Command2_Click()Text2.Text = Text1.SelTextText2.FontName = Text1.FontNameText2.FontSize = Text1.FontSizeEnd Sub
Text的滚动条在ScrollBars属性中设置
?
实验14
Private Sub Form_Click()??? Caption = 鼠标单击??? Picture = LoadPicture(App.Path + \COVER01.BMP)End SubPrivate Sub Form_DblClick()??? Caption = 鼠标双击??? Picture = LoadPicture()End SubPrivate Sub Form_Load()??? Caption = 装入窗体??? Picture = LoadPicture(App.Path + \WINDOW.JPG)End Sub
?
实验21
Private Sub Command1_Click()r = Text1.Texta = 3.14Label2.Caption = Format(r * r * a, 0.00)End Sub
Private Sub Command2_Click()r = Text1.Texta = 3.14Label3.Caption = Format(2 * r * a, 0.00)End Sub
Private Sub Text1_LostFocus()If Not IsNumeric(Text1) Or Val(Text1) = 0 Then? MsgBox 输入错误,请重新输入!, vbOKOnly, 警告? Text1.Text = ? Text1.SetFocusEnd IfEnd Sub
?
实验22
Private Sub Command1_Click()Text1.Text = UCase(Text1.Text)End Sub
Private Sub Command2_Click()Text1.Text = Len(Text1.Text)End Sub
?
实验23
方法一
Private Sub Form_Click()Dim a As Integer, b As Integer, c As Integer, d As Integer, e As Integer, f As Integerd = Int(Rnd * 900) + 100Print da = d \ 100b = (d Mod 100) \ 10c = d Mod 10? If c = 0 Then? e = a + b * 10? Print 0 e? Else? e = a + b * 10 + c * 100? Print e? End IfEnd Sub
方法二
Private Sub Form_Click()num = Int(Rnd * 900) + 100Print numa = Left(num, 1)b = Mid(num, 2, 1)c = Right(num, 1)Print Spc(1); c; b; aEnd Sub
?
实验24
Private Sub Form_Load()Text1.Text = VisualBasic程序设计教程(第三版)Label1.Caption = Left(Text1.Text, 11)Label1.Font = Text1.FontLabel2.Caption = Mid(Text1.Text, 12, 6)Label2.Font = Text1.FontLabel3.Caption = Right(Text1.Text, 5)Label3.Font = Text1.FontEnd Sub
?
实验25
Private Sub Form_Click()Dim a!, b!, c!, d!,
文档评论(0)