Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        'Using writer As System.IO.StreamWriter = New System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "Word List.Txt", True)
        Using writer As System.IO.StreamWriter = New System.IO.StreamWriter("C:\Users\Home\Desktop\lessons Word\Word List.Txt", True)
            Dim curLine As String = TextBox1.Text
            If (TextBox1.Text.Count > 1) Then
                curLine = ""
                For Each line As String In TextBox1.Text
                    curLine = curLine & "" & line
                Next
                curLine = curLine.Trim()
            End If
            writer.WriteLine(curLine)
        End Using

    End Sub

And i am write above code it is work but,if i active fist line and deactivate second line code not work,i want active fist line .he said cant find the path.

please help me

thank you

wansa

Your problem is you're not paying attention to what the New constructor for StreamWriter wants and what GetfolderPath is supplying. The constructors that accept a string, only accept one string, the full path of the file to open. GetFolderPath only supplies the path of the directory you specify, which, in your case, means that you need to specify the subfolder as well as the path delimiter:

Using writer As System.IO.StreamWriter = New System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "\lessons Word\Word List.Txt", True)

On a side note, every time you concatenate a string(&), a new string is created, the old isn't added to. I would suggest either use, a StringBuilder or write each line to the file separately.

Dear sir.
its working 100% thank you for your support.
thank you
wansa

Imports System.IO
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Using writer As System.IO.StreamWriter = New System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "\lessons Word\Word List.Txt", True)
            Dim curLine As String = TextBox1.Text
            If (TextBox1.Text.Count > 1) Then
                curLine = ""
                For Each line As String In TextBox1.Text
                    curLine = curLine & "" & line
                Next
                curLine = curLine.Trim()
            End If 
            writer.WriteLine(curLine)
        End Using
    End Sub

End Class

Please remember to mark the post solved if your question is answered. Thank You