dear sir
my project availble two text box and one button i want two textbox include data save to one .txt file it is posible .
thank you
wansa

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Using writer As System.IO.StreamWriter = New System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "\word\correct.Txt", True)
            Dim curLine As String = TextBox1.Text & (CInt(Space(5) & Trim(TextBox2.Text)))
            If (TextBox1.Text.Count > 1) Then
                curLine = ""
                For Each line As String In TextBox1.Text & (CInt(Space(5) & Trim(TextBox2.Text)))
                    curLine = curLine & "" & line
                Next
                curLine = curLine.Trim()
            End If
            writer.WriteLine(CInt(Space(5) & Trim(TextBox2.Text)))
        End Using
        TextBox1.Text = Nothing
        TextBox2.Text = Nothing
    End Sub

Recommended Answers

All 2 Replies

With every button click, you are making a new appendable file.
Try to rearrange your code, the button click, should only append two txtboxes to your file.
Success. :)

dear sir

thank you for your reply.i will try.
thank you
wansa

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.