0

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
2
Contributors
2
Replies
13
Views
4 Months
Discussion Span
Last Post by Karuna_2
1

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. :)

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.