怎样把vb.net中出入的数据存储为txt格式的文件
2个回答
2012-05-03
展开全部
我原来写的一个方法
Private Sub StrToFile(ByVal cExpression As String, ByVal cFileName As String, ByVal lAdditive As Boolean)
If File.Exists(cFileName) And Not lAdditive Then
File.Delete(cFileName)
End If
Dim oFs As FileStream = New FileStream(cFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite)
Dim oWriter As StreamWriter = New StreamWriter(oFs)
Dim C2_STR_FILE As Boolean = True
oWriter.BaseStream.Seek(0, SeekOrigin.End)
oWriter.Write(vbCrLf)
oWriter.Write(cExpression)
oWriter.Flush()
oWriter.Close()
oFs.Close()
End Sub
Private Sub StrToFile(ByVal cExpression As String, ByVal cFileName As String, ByVal lAdditive As Boolean)
If File.Exists(cFileName) And Not lAdditive Then
File.Delete(cFileName)
End If
Dim oFs As FileStream = New FileStream(cFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite)
Dim oWriter As StreamWriter = New StreamWriter(oFs)
Dim C2_STR_FILE As Boolean = True
oWriter.BaseStream.Seek(0, SeekOrigin.End)
oWriter.Write(vbCrLf)
oWriter.Write(cExpression)
oWriter.Flush()
oWriter.Close()
oFs.Close()
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询