本文实例讲述了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程序设计有所帮助。
最后
以上就是追寻钢笔最近收集整理的关于VB打开与保存txt文件的方法的全部内容,更多相关VB打开与保存txt文件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复