VB打开与保存txt文件的方法
来源:本站原创|时间:2022-11-25|栏目:vb|
本文实例讲述了VB打开与保存txt文件的方法。分享给大家供大家参考。具体如下:
Private Sub cmdsave_Click() Dim filelocation As String ' loads save as box commondialog1.ShowSave filelocation = commondialog1.FileName ' append saves over file if it assists Open filelocation For Append As #1 Print #1, text1.text Close #1 End Sub Private Sub cmdopen_Click() Dim filelocation As String ' show open box commondialog1.ShowOpen filelocation = commondialog1.FileName ' input files into text1.text Open filelocation For Input As #1 Do Until EOF(1) Input #1, Data text1.text = text1.text + Data + vbNewLine EOF (1) Loop Close #1 End Sub
希望本文所述对大家的VB程序设计有所帮助。
您可能感兴趣的文章
- 01-10VBScript教程 第十三课 VBScript与窗体
- 01-10VBS教程:正则表达式简介 -选择与编组
- 01-10VBS教程:函数-Chr 函数
- 01-10VBS教程:VBScript 与窗体
- 01-10VBS教程:函数-Asc 函数
- 01-10VBS脚本病毒原理分析与防范
- 01-10打开QQ并且让它自己输入用户名和密码的vbs脚本
- 01-10vbs定时发送邮件的方法与代码
- 01-10用VBS实现脚本结束进程与防止进程启动
- 01-10用vbs实现在启动 Windows 资源管理器时打开特定文件夹