hi i am facing overwriting file in window mobile 6 professional.

bellow are my code.

when the system start loading:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim line As String
        Dim Lat As StreamReader = New StreamReader("\Program Files\please_must_be_ok\Resources\contact1.txt")
        line = Lat.ReadToEnd()
        TextBox1.Text = line
        Lat.Close()
    End Sub

the system will automatic load the file contact1.txt contact number to TextBox1.Text
if the user want to change the contact display at TextBox1.Text, the user required key the new contact number at TextBox1.Text, then click the Button1 to save the contact number to file "contact1.text"

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


        Dim Lat As StreamWriter = New StreamWriter("\Program Files\please_must_be_ok\Resources\contact1.txt")
        Lat.WriteLine(TextBox1.Text)
        Lat.Close()

    End Sub

my problem now is, i can't overwrite the contact number in file "contact1.txt"


kindly advice, how can i overwrite the "contact1.txt" file in window mobile 6 professional.

thank a lot

after i double checking the file.

The file is overwrite after i click the button (when the program is still running), but after i close the program and run it again, it just show me the old contact without change to new contact that overwrite just now.

kindly advice how can i permanent overwrite a text file.

thanks a lot.

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.