Hi wondered if any one could help me, my problem is im creating a windows application in vb 2005, there are 10 text box's where i need to save to one text file but i am inserting before the user enters any text a string variable which can be loaded in from flash dynamically :-
you can see "header7=" and "body7=" this is so that the action script can load in the text to that specific variable.Code:Try If System.IO.File.Exists(FILE_NAME7) And Mod7Header.Enabled = True Then Dim objWriter As New System.IO.StreamWriter(FILE_NAME7) objWriter.BaseStream.Seek(0, SeekOrigin.End) objWriter.WriteLine("header7=" + ((Mod7Header.Text)) & ControlChars.CrLf) objWriter.WriteLine("body7=" + ((Mod7MidText.Text))) objWriter.Flush() objWriter.Close() Else 'If Mod7Header.Text = "" Then ' MsgBox("Module 7 Header Text has not been filled in") 'End If End If Catch ex As System.IO.IOException End Try
My problem is then loading in the text into there respective text box's inwhich they came from. i can filter the ("header7=" and "body7=") out by using this code:-
the first text box loads in the text as it should but the second loads in the firsts and seconds text. How can i tell it to read in from the second line? i have tried limiting the first text box to 20 chars and then telling (sr7b.basestream.seek(20,seekorigin.begin) so that it miss's the first 20 chars but it just shows a blank line, how can i get around this any one have any ideas??Code:If System.IO.File.Exists(FILE_NAME7) = True Then Dim sr7 As New IO.StreamReader(FILE_NAME7) sr7.BaseStream.Seek(0, SeekOrigin.Begin) While sr7.Peek <> -1 TextLine7 = TextLine7 & sr7.ReadLine() & ControlChars.CrLf End While sr7.Close() Mod7Header.Text = TextLine7 Mod7Header.Text = Mod7Header.Text.Replace("header7=", "") End If If System.IO.File.Exists(FILE_NAME7) = True Then Dim sr7b As New IO.StreamReader(FILE_NAME7) sr7b.BaseStream.Seek(0, SeekOrigin.Begin) While sr7b.Peek <> -1 TextLineB7 = TextLineB7 & sr7b.ReadLine() End While sr7b.Close() Mod7MidText.Text = TextLineB7 Mod7MidText.Text = Mod7MidText.Text.Replace("body7=", "") End If
Thanks in Advance
Neil


Reply With Quote