2020年5月19日 星期二

vb.net Output到記事本[StreamWriter] [Output to TXT File]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        Dim strInfo As String = "Test"


        Dim strFileName As String = Application.StartupPath & "\test.txt"


        Dim mySW As StreamWriter

        Dim fs As FileStream

        fs = New FileStream(strFileName, FileMode.OpenOrCreate)

        mySW = New StreamWriter(fs, System.Text.Encoding.Default)

        mySW.Write(strInfo)

        mySW.Close()


        MsgBox("OK")

    End Sub

沒有留言:

張貼留言