1.

Solve : Writing multiple text to a text file?

Answer»

Hello, I am trying to write multiply text from textboxes. I am USING this code for a single textbox. Can someone help me to modify this code to write from multiply textboxes. Thank you.
Dim FILE_NAME As String = "C:\ test2.txt"
If System.IO.File.Exists(FILE_NAME) Then
objWriter.Write(Textbox1.Text)
objWriter.Close()
MsgBox("Text written to file")
ELSE
MsgBox("File doesn't exist")
End ifQuote

I am trying to write multiply text from textboxes.
. . .
Quote
to write from multiply textboxes.

Do you mean multiple?


If you do then


Can't you just make another textbox and add another line?
Code: [Select]Dim FILE_NAME As String = "C:\ test2.txt"
If System.IO.File.Exists(FILE_NAME) Then
objWriter.Write(Textbox1.Text)
objWriter.Write(Textbox2.Text)
objWriter.Close()
MsgBox("Text written to file")
Else
MsgBox("File doesn't exist")
End if


else


Then you must want to multiply it. Just add another textbox and use this code.
Code: [Select]Dim FILE_NAME As String = "C:\ test2.txt"
If System.IO.File.Exists(FILE_NAME) Then
objWriter.Write(Val(Textbox1.Text) * Val(Textbox2.Text))
objWriter.Close()
MsgBox("Text written to file")
Else
MsgBox("File doesn't exist")
End if


end if

If I don't have it right then

Could you explain it more CLEARLY?

end ifQuote from: Linux711 on November 21, 2009, 01:29:41 AM
end if

If I don't have it right then

Could you explain it more clearly?

end if

What's with the "end if"I was trying to make the whole thing like a program.Quote from: Linux711 on November 21, 2009, 02:15:38 AM
I was trying to make the whole thing like a program.

Why not just give a straight answer instead so that there is less chance for confusion?Thanks all who replied. My problem is solved


Discussion

No Comment Found