资源描述:
《VB实验Word编码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、实验2-1aPrivateSubCommand1_Click()Text2.Text=2*3.14*Val(Text1)EndSubPrivateSubCommand2_Click()Text3.Text=3.14*Val(Text1)^2EndSubPrivateSubText1_LostFocus()IfNotIsNumeric(Text1)Theni=MsgBox("输入了非数字字符!",64,"提示")Text1=""Text1.SetFocusEndIfText2=""Text3=""EndSub实验2-2aPri
2、vateSubCommand1_Click()EndEndSubPrivateSubCommand2_Click()Text1.ForeColor=RGB(255,0,0)Text2.ForeColor=RGB(255,0,0)Text2.PasswordChar=""Text1=(Text1="20060000")Text2=(Text2="TJin1234")EndSubPrivateSubText1_GotFocus()Text1=""Text1.ForeColor=RGB(0,0,0)EndSubPrivateSub
3、Text2_GotFocus()Text2=""Text2.ForeColor=RGB(0,0,0)Text2.PasswordChar="*"EndSub实验2-2bPrivateSubCommand1_Click()Text2=UCase(Text1)EndSubPrivateSubCommand2_Click()Text2=LCase(Text1)EndSubPrivateSubCommand3_Click()Text3=Len(Text1)Text4=Len(Trim(Text1))EndSub实验2-2cPriva
4、teSubCommand1_Click()Dimdate1AsDatedate1=DateValue(Text1&","&Text2&","&Text3)Label7="今天距新日期还有"&DateDiff("yyyy",Date,date1)&"年、"&DateDiff("m",Date,date1)&"月、"&DateDiff("d",Date,date1)&"天"EndSubPrivateSubForm_Load()Label1="今天是"&Year(Date)&"年"&Month(Now)&"月"&Day(Date)
5、&"日"Label2="现在是"&Hour(Time)&"点"&Minute(Now)&"分"&Second(Time)&"秒"EndSub实验2-3aPrivateSubCommand1_Click()Dimx%,y%x=Text1:y=Text2x=yText3=xText4=yEndSubPrivateSubCommand2_Click()Dimx%,y%x=Text1:y=Text214y=xText3=xText4=yEndSubPrivateSubCommand3_Click()Dimx%,y%x=Text1:y
6、=Text2x=x+1Text3=xText4=yEndSubPrivateSubCommand4_Click()Dimx%,y%x=Text1:y=Text2x=x+yText3=xText4=yEndSubPrivateSubCommand5_Click()Dimx%,y%x=Text1:y=Text2x=y:y=xText3=xText4=yEndSubPrivateSubCommand6_Click()Dimx%,y%,t%x=Text1:y=Text2t=x:x=y:y=tText3=xText4=yText5=t
7、EndSub实验2-3bPrivateSubCommand1_Click()Dimr1!,r2!,r3!,x!r1=Val(Text1):r2=Val(Text2):r3=Val(Text3)x=1/(1/r1+1/r2+1/r3)Label5="计算结果:"&xEndSub实验3-1aPrivateSubCommand1_Click()Dimbsh!,shj!,chj$bsh=Val(Text1):shj=Val(Text2)Ifbsh>=60ThenIfshj>=60ThenText3="合格"ElseText3="笔试
8、合格"EndIfElseIfshj>=60ThenText3="上机合格"ElseText3="不合格"EndIfEndIfEndSub实验3-1bPrivateSubCommand1_Click()Dimm1!,m2!,c$,strc$,m!,i%strc="+-*/"IfNotIsNu