工具软件   办公软件   操作系统   网络安全   设计在线   程序开发   教程宝典   软件下载   软件论坛
您的位置:软件 > 开发者网络 > 开发工具 > 开发专栏 > VB > 正文
Visual Basic上机考试综合应用题选讲
[文章信息]
作者:
时间:2005-02-21
出处:blog
责任编辑:方舟
[文章导读]
素数判断与计算、输出题,并把计算与存盘部分补充完整
advertisement
热点推荐
· 所有Win XP系统将自动升级至SP2
· 动画图解:在Word中绘制表格
· AutoCAD中“布局”的使用
· 谈跨平台C++动态连接库的实现
· [视频]PS简单去除水印(二)
[正文]

上一页  1 2 3 4  下一页

  五、倒计数器


Private Sub C1_Click(Index As Integer)
 Select Case Index
  Case 1
   Timer1.Enabled = False
  Case 0
   Timer1.Enabled = True
 End Select
End Sub

Private Sub Form_Load()

End Sub

Private Sub Timer1_Timer()
 Text1.Text = Text1.Text + 1
End Sub

  六、文本框的使用


Private Sub C1_Click()
 Open App.Path & "\out7.txt" For Output As #2
 Print #2, Text1.Text
 Close #2
End Sub

Private Sub Form_Load()
 Open App.Path & "\in7.txt" For Input As #1
 Do While Not EOF(1)
  Input #1, mystring
  Text1.Text = Text1.Text + mystring
 Loop
 Close #1
 Text1.Text = "计算机等级考试" + Text1.Text
End Sub

  七、求某类数的和等:


Private Function fun(a As Integer) As Integer
 s% = 0
 For i% = 500 To 600
  If Int(i% / a) = i% / a Then
   s% = s% + i%
  End If
 Next
 fun = s%
End Function

Private Sub C1_Click()

 If Op1.Value Then
  Text1 = fun(7)
 End If
 If Op2.Value Then Text1 = fun(3)

End Sub

Private Sub Form_Unload(Cancel As Integer)
 Open "out7.txt" For Output As #1
 Print #1, Op1.Value, Op2.Value, Text1.Text
 Close #1
End Sub

  八、文本框的使用


Private Sub C1_Click()
 Open App.Path & "\in7.txt" For Input As #1
 Do While Not EOF(1)
  Input #1, mystring
  Text1.Text = mystring
 Loop
 Close #1
End Sub

Private Sub C2_Click()
 Text1.Text = UCase(Text1.Text)
End Sub

Private Sub C3_Click()
 Open App.Path & "\out7.txt" For Output As #2
 Print #2, Text1.Text
 Close #2
End Sub

  九、文本框应用第二例:


  第一部分,窗体程序部分:

Dim a(100) As Integer
Private Sub Cmd1_Click()
 Open App.Path & "\in.txt" For Input As #1
 Text1.Text = ""
 For i = 1 To 100
  Input #1, a(i)
  Text1.Text = Text1.Text & a(i) & Space(1)
 Next i
 Close #1

End Sub

Private Sub Cmd2_Click()
 Text1.Text = ""
 s = 0
 For i = 1 To 100
  If a(i) Mod 2 <> 0 Then
   Text1.Text = Text1.Text & a(i) & Space(1)
   s = s + a(i)
  End If
 Next
 putdata s
End Sub

  第二部分,模块程序部分:(如没有,需要自行添加一个标准模块)

Sub putdata(ByVal a As Integer)
 Dim sFile As String
 sFile = "\out.txt"
 Open App.Path & sFile For Output As #1
 Print #1, a;
 Close #1
End Sub


上一页  1 2 3 4  下一页

天极社区邀请您:写博客日记  上传相片   论坛聊天  订阅电子杂志  推荐网摘   免费图铃工具
笔名:   请您注意:

 遵守国家有关法律、法规,尊重网上道德,承担一切因您的行为而直接或间接引起的法律责任。

 天极网拥有管理笔名和留言的一切权利。
评论:
 
发表评论推荐给朋友我想参加相关培训打印我对此感兴趣订阅电子杂志
相关内容焦点新闻
  • VB编程破解Windows屏幕保护密码
  • 真没想到VB也可以这样用之指针技术
  • 在VB6中用命令行为模式控制GUI动作
  • VB设计Win2000下截获IP数据包程序
  • 真没想到VB也可以这样用之VB能做什么
  • UT斯达康大规模裁员 引起公司内部恐慌
  • 体验美国网上退货 感受当代电子商务的精髓
  • 《电子认证服务管理办法》通过审议并发布
  • 微软打折WinXP乏人问津 在华陷入尴尬境地
  • 手机闲置造成资源浪费 专家呼吁早出台法规
  • 亚迅人间蒸发 2005年数码通路迎来第一场雪
  • 05年最强“枪”稿之一 创新要将苹果拉下马
  • 数码相机全行业告急 利润缩水日韩企业退场
  • Advertisement