Visual Basic Dot Net程序设计教程第2版课后实验题.docx
《Visual Basic Dot Net程序设计教程第2版课后实验题.docx》由会员分享,可在线阅读,更多相关《Visual Basic Dot Net程序设计教程第2版课后实验题.docx(10页珍藏版)》请在冰豆网上搜索。
![Visual Basic Dot Net程序设计教程第2版课后实验题.docx](https://file1.bdocx.com/fileroot1/2023-2/3/e44754c7-c3fc-42ac-9fb7-9f1cb2c55709/e44754c7-c3fc-42ac-9fb7-9f1cb2c557091.gif)
VisualBasicDotNet程序设计教程第2版课后实验题
实验二
第一题
PublicClassForm1
Dima,b,cAsInteger,avAsSingle
PrivateSubB1_Click(senderAsObject,eAsEventArgs)HandlesB1.Click
Randomize()
T1.Text=""
T2.Text=""
T3.Text=""
a=Int(Rnd()*(9-0+1)+0)
b=Int(Rnd()*(99-10+1)+10)
c=Int(Rnd()*(999-100+1)+100)
T1.Text=Val(a)
T2.Text=Val(b)
T3.Text=Val(c)
EndSub
PrivateSubB2_Click(senderAsObject,eAsEventArgs)HandlesB2.Click
av=(a+b+c)/3
L5.Text=Val(av)
EndSub
PrivateSubB3_Click(senderAsObject,eAsEventArgs)HandlesB3.Click
End
EndSub
EndClass
第四题
PublicClassForm1
PrivateSubForm1_Load(senderAsObject,eAsEventArgs)HandlesMyBase.Load
T1.Font=NewFont("BaskervilleOldFace",12)
T2.Font=NewFont("BaskervilleOldFace",12)
T1.Text="Youarethebest,butIambetter.Socomeon!
"
EndSub
PrivateSubB1_Click(senderAsObject,eAsEventArgs)HandlesB1.Click
T2.Text=Len(T1.Text)
EndSub
PrivateSubB2_Click(senderAsObject,eAsEventArgs)HandlesB2.Click
T2.Text=UCase(T1.Text)
EndSub
PrivateSubB3_Click(senderAsObject,eAsEventArgs)HandlesB3.Click
T2.Text=LCase(T1.Text)
EndSub
PrivateSubB4_Click(senderAsObject,eAsEventArgs)HandlesB4.Click
T2.Text=Trim(T1.Text)
EndSub
PrivateSubB5_Click(senderAsObject,eAsEventArgs)HandlesB5.Click
T2.Text=StrDup(5,"S")
EndSub
PrivateSubB6_Click(senderAsObject,eAsEventArgs)HandlesB6.Click
T2.Text=InStr(T1.Text,"are")
EndSub
PrivateSubB7_Click(senderAsObject,eAsEventArgs)HandlesB7.Click
T2.Text=Replace(T1.Text,"but","while")
EndSub
PrivateSubB8_Click(senderAsObject,eAsEventArgs)HandlesB8.Click
T2.Text=Mid(T1.Text,33,16)
EndSub
EndClass
第六题
PublicClassForm1
Dima,bAsInteger
PrivateSubB1_Click(senderAsObject,eAsEventArgs)HandlesB1.Click
T1.Text=""
T2.Text=""
Randomize()
a=Int(Rnd()*(999-100+1)+100)
T1.Text=Val(a)
EndSub
PrivateSubB2_Click(senderAsObject,eAsEventArgs)HandlesB2.Click
b=a\100+(a\10Mod10)*10+(aMod10)*100
T2.Text=b
EndSub
EndClass