lads, I'm having problems with saving user input to text file. Need use the streamWritter to write users names and passwords to text file I gues the arrays would work out but the code is mess and I'm stock with this:
[code]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim file As System.IO.StreamWriter
Dim dir As String = "c:\base.text"
If file.Exists("c:\base.txt") Then
file = My.Computer.FileSystem.OpenTextFileWriter("c:\base.txt", True)
file = appendText("strUserName")
Else
My.Computer.FileSystem.CreateDirectory(dir)
file = New StreamWriter("C:\base.txt")
file.Close()
End If
End Sub
streamWritter arrays to text file
Page 1 of 12 Replies - 318 Views - Last Post: 29 April 2010 - 07:12 AM
Replies To: streamWritter arrays to text file
#2
Re: streamWritter arrays to text file
Posted 29 April 2010 - 01:57 AM
The following is a simple example of how to use a streamwriter to write a text file. Excuse if my syntax is slightly off but I can't type code to save my life without visual studio to correct my errors 
Hope it helps.
Dim writer as new streamwriter(dir) Dim dir as string = "C:\test.txt" writer.writeline(username & " " & password) writer.close()
Hope it helps.
#3
Re: streamWritter arrays to text file
Posted 29 April 2010 - 07:12 AM
Just a quick note on r1zla's code, be sure to declare dir before using it in the streamwriter declaration
And you may need to open the streamwriter, but I'm not 100% on that one. Otherwise, that's the short and long of it.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|