VB 编程题汇编.ppt
《VB 编程题汇编.ppt》由会员分享,可在线阅读,更多相关《VB 编程题汇编.ppt(47页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、VB 编程题汇编Private Sub command1_Click()不得删除本行注释Dim a As Integer,b As Double,i As Integer,n As Integern=Val(Text1.Text)a=0b=0For i=1 To na=a+ib=b+aNext iText2.Text=bEnd Sub Private Sub Command1_Click()不得删除本行注释Dim i%,xh$,xm$Open App.Path&Xhxm.txt For Output As#1For i=1 To 3 xh=InputBox(请输入学号)xm=InputBox(
2、请输入姓名)Write#1,xh,xm Next iClose#1End SubPrivate Sub Command2_Click()不得删除本行注释Dim s as stringOpen App.Path&Xhxm.txt For Input As#2Do While Not EOF(2)Line Input#2,sText1.Text=Text1.Text&s&vbCrLfLoopClose#2End SubPrivate Sub Command1_Click()Dim n As Integer,i As Integer,s As Doublen=Val(Text1.Text)s=0Fo
3、r i=1 To n s=s+i 2Next iText2.Text=sEnd SubPrivate Sub Command1_Click()”读取文件”按钮代码不得删除本行注释Dim st As StringText1.Text=Open App.Path&“jmwb.txt For Input As#1While Not EOF(1)Input#1,stText1.Text=Text1.Text+st+vbCrLfWendClose#1End SubPrivate Sub Command2_Click()Dim s As String,co As String,c As String,Di
4、m n As Integer,i As Integer,p As Integers=Trim(Text1.Text)n=Len(s)co=For i=1 To n c=Mid(s,i,1)p=Asc(c)+5 co=co+Chr(p)Next iText2.Text=coEnd SubPrivate Sub Command1_Click()Dim char As String*1char=Trim(Text1.Text)If Not IsNumeric(char)Then If(Asc(char)=65 And Asc(char)=97 And Asc(char)=120)Then Label
5、1.Caption=输入的是字母 Else:Label1.Caption=输入的是其它符号 End IfElse:Label1.Caption=输入的是数字End IfEnd Sub课本有完整代码课本有完整代码Private Sub Command1_Click()Text1.Text=UCase(Text1.Tag)End SubPrivate Sub Command2_Click()Text1.Text=LCase(Text1.Tag)End SubPrivate Sub Command3_Click()Text1.Text=Text1.TagEnd SubPrivate Sub Text
6、1_KeyUp(KeyCode As Integer,Shift As Integer)对于文本框控件中输入的每次键盘按键弹起事件做一次文本内容保存Text1.Tag=Text1.Text用Text1.Tag属性作为保存textbox控件文本内容的临时存储区End SubPrivate Sub command1_Click()不得删除本行注释不得删除本行注释Dim a As Integer,b As Integer,c As IntegerDim max As Integer,min As Integera=Val(Text1.Text)b=Val(Text2.Text)c=Val(Text3
7、.Text)max=a+b+Abs(a-b)max=max/2min=a+b-Abs(a-b)min=min/2max=max+c+Abs(max-c)max=max/2min=min+c-Abs(min-c)min=min/2Text4.Text=maxText5.Text=minEnd Sub课本有完整代码课本有完整代码Private Sub Command1_Click()Dim a As Integera=Val(Text1.Text)If(a Mod 4=0 And a Mod 100 0)Or a Mod 400=0 Then Text2.Text=闰年Else:Text2.Tex
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- VB 编程题汇编 编程 汇编
限制150内