主题:如何把TEXT栏中数据保存成文本文件
bjhdyb
[专家分:270] 发布于 2006-10-03 21:07:00
如何把TEXT栏中数据保存在相对路径下的文本文件,用VB.NET怎么用啊??
回复列表 (共1个回复)
沙发
anlige [专家分:270] 发布于 2007-02-26 02:29:00
Imports System.IO
Dim stre As Stream
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sstr As String = TextBox1.Text
Dim byts() As Byte = System.Text.Encoding.Default.GetBytes(sstr.ToCharArray)
Try
stre = File.OpenWrite("E:\anlige\code.txt")
stre.Write(byts, 0, byts.Length)
stre.Close()
stre = Nothing
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Information")
End Try
End Sub
把路径该为年的路径就好了!
我来回复