I don't ask for help much until I've literally pissed myself off trying it but i am making a simple form for a massage program and on this form you will be able to load multiple lists, remove 1 string of duplicate entries if it exists, sort the file alphabetically and save the file and be able to repeat this process as many times as needed.
as of right now the load function will only load 1 file at a time using the following code:
The code for the save file will save the file but it changes on every instance to some odd autosave function. For example Open file lol save as lol2 [works fine until this part] then open file rotfl (this is when the file lol2 will be overwritten with the file rotfl)Code:Dim AllText As String = "", LineOfText As String = "" OpenFileDialog1.Filter = "Text files (*.TXT)|*.TXT" OpenFileDialog1.ShowDialog() 'display Open dialog box If OpenFileDialog1.FileName <> "" Then Try 'open file and trap any errors using handler FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) Do Until EOF(1) 'read lines from file LineOfText = LineInput(1) 'add each line to the AllText variable AllText = AllText & LineOfText & vbCrLf Loop Label1.Text = OpenFileDialog1.FileName 'update label TextBox1.Text = AllText 'display file Catch MsgBox("Error opening file.") Finally FileClose(1) 'close file End Try End If End Sub
any suggestions? i thought this out and made this pretty clearCode:SaveFileDialog1.Filter = "Text files (*.txt)|*.txt" SaveFileDialog1.ShowDialog() If SaveFileDialog1.FileName <> "" Then FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output) PrintLine(1, TextBox1.Text) 'copy text to disk FileClose(1) End If End Sub





Reply With Quote