资源描述:
《VB实验答案 简明版本》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验11PrivateSubCommand1_Click()Label3.Caption=Text1.TextEndSub 实验12PrivateSubForm_Click()Text1.Text=Text1.Text+1EndSubText1的初始值设为0,Label1的Autosize属性设为True 实验13PrivateSubCommand1_Click()Text1.FontName="隶书"Text1.FontSize=25EndSubPrivateSubCommand2_Click()Text2.Text=Text1.SelTextText2.FontName=Te
2、xt1.FontNameText2.FontSize=Text1.FontSizeEndSubText的滚动条在ScrollBars属性中设置 实验14PrivateSubForm_Click() Caption="鼠标单击" Picture=LoadPicture(App.Path+"COVER01.BMP")EndSubPrivateSubForm_DblClick() Caption="鼠标双击" Picture=LoadPicture("")EndSubPrivateSubForm_Load() Caption="装入窗体" Picture=Lo
3、adPicture(App.Path+"WINDOW.JPG")EndSub 实验21PrivateSubCommand1_Click()r=Text1.Texta=3.14Label2.Caption=Format(r*r*a,"0.00")EndSubPrivateSubCommand2_Click()r=Text1.Texta=3.14Label3.Caption=Format(2*r*a,"0.00")EndSubPrivateSubText1_LostFocus()IfNotIsNumeric(Text1)OrVal(Text1)<=0Then MsgBox"输入错误
4、,请重新输入!",vbOKOnly,"警告" Text1.Text="" Text1.SetFocusEndIfEndSub 实验22PrivateSubCommand1_Click()Text1.Text=UCase(Text1.Text)EndSubPrivateSubCommand2_Click()Text1.Text=Len(Text1.Text)EndSub 实验23方法一PrivateSubForm_Click()DimaAsInteger,bAsInteger,cAsInteger,dAsInteger,eAsInteger,fAsIntegerd=Int(Rnd*
5、900)+100Printda=d100b=(dMod100)10c=dMod10 Ifc=0Then e=a+b*10 Print"0"&e Else e=a+b*10+c*100 Printe EndIfEndSub方法二PrivateSubForm_Click()num=Int(Rnd*900)+100Printnuma=Left(num,1)b=Mid(num,2,1)c=Right(num,1)PrintSpc(1);c;b;aEndSub 实验24PrivateSubForm_Load()Text1.Text="VisualBasic程序设计教程(第三版)"Lab
6、el1.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.FontEndSub 实验25PrivateSubForm_Click()Dima!,b!,c!,d!,e! a=Val(InputBox("请输入一个正实数","计算","")) b=Val(Format(a^2,"0.###")) c=Format(Sqr(
7、a),"0.###") d=Format(a^3,"0.###") e=Format(a^(1/3),"0.###")Printb;Spc(2);c;Spc(2);d;Spc(2);eEndSub 实验31PrivateSubCommand1_Click()x=Val(Text1.Text)Ifx<=10Then Label3.Caption=30ElseIfx>10Andx<=50Then Label3.Caption=30+(x-10)*2.5ElseIfx>50Then y