资源描述:
《vb语言程序设计课后编程和上机调试参考答案》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、专业资料VB语言程序设计课后编程及上机调试参考答案ex0101PrivateSubLabel1_Click()Caption="练习"Command1.Caption="确定"Label1.FontBold=TrueLabel1.AutoSize=TrueLabel1.Caption="VisualBasic程序设计教程"EndSubex0102PrivateSubCommand1_Click()Txt.Text="我有电脑"EndSubPrivateSubCommand2_Click()Txt.Text="我没有电脑"EndSubPrivateS
2、ubCommand3_Click()Txt.Text=""'一对双撇号,中间不留空EndSubex0104PrivateSubCommand1_Click()DimxAsSinglex=Val(Text1.Text)Text2.Text=15*xEndSubex0202PrivateSubForm_Click()DimrAsSingle,sAsSingler=4.6s=3.14159*r^2Text1.Text="圆的面积为"&sEndSubex0204PrivateSubCommand1_Click()'"最大化"按钮Form1.WindowSt
3、ate=2'最大化EndSubPrivateSubCommand2_Click()'"还原"按钮Form1.WindowState=0'还原word完美格式专业资料EndSubPrivateSubCommand3_Click()'"最小化"按钮Form1.WindowState=1'最小化EndSubex0205PrivateSubcommand1_click()DimxAsSingleDimyAsSinglex=Val(Text1.Text)y=Val(Text2.Text)Text3.Text=x*x+y*yEndSubex0206Privat
4、eSubcommand1_click()DimxAsStringx=Text1.TextText2.Text=Left(x,1)+Right(x,1)EndSubex0301PrivateSubForm_Load()DimxAsInteger,yAsIntegerDimaAsInteger,bAsInteger,cAsIntegerx=Val(InputBox("请输入一个三位数"))a=Int(x/100)'求百位数b=Int(x/10)-a*10'求十位数c=xMod10'求个位数Showy=c*100+b*10+a'生成倒序数Printx;"
5、倒序数为:";y'显示倒序数EndSubex0302PrivateSubCommand1_Click()n=Val(Text1.Text)Randomizex=Int(1+n*Rnd)Label1.Caption="第一个随机数"+Str(x)x=Int(1+n*Rnd)Label2.Caption="第二个随机数"+Str(x)x=Int(1+n*Rnd)Label3.Caption="第三个随机数"+Str(x)word完美格式专业资料EndSubex0303PrivateSubCmd1_Click()Lab1.Visible=TrueLab1
6、.Caption="您已下达显示命令"EndSubPrivateSubForm_Click()Cmd1.Visible=TrueEndSubex0304PrivateSubForm_KeyPress(KeyAsciiAsInteger)ShowPrint"输入字符:";Chr(KeyAscii),"ASCII码为;";KeyAsciiEndSubPrivateSubForm_DblClick()ClsEndSubex0305PrivateSubForm_Load()x=MsgBox("在这里显示提示信息",4+0,"请确认")x=MsgBox("在
7、这里显示"+Chr(13)+"提示信息",3+0,"请确认")x=MsgBox("在这里显示"+Chr(13)+"提示信息",2+16+0,"请确认")EndSubex0401PrivateSubForm_Load()DimxAsLong,sAsStringx=InputBox("输入一个整数(1~35000)")s="奇数"IfxMod2=0Thens="偶数"MsgBoxsEndSubex0402PrivateSubCommand1_Click()DimaAsSingle,bAsSingleDimcAsSingle,dAsSingleDimmA
8、sSingle,nAsSingle,xAsSingleShowa=Val(Text1.Text)b=Val(Text2.T