Click here to Skip to main content
15,908,901 members

Comments by Sh3R3iF (Top 3 by date)

Sh3R3iF 30-Mar-18 4:49am View    
that's for save and save as
my problem with double clicked file
Sh3R3iF 30-Mar-18 4:48am View    
Shared Sub Save(txtDisplay As TextBox)
If EditorForm.DocumentName = "Untitled" Then
SaveAs(txtDisplay)
Else
Dim SaveFile As New StreamWriter(EditorForm.DocumentPath)
SaveFile.Write(txtDisplay.Text)
SaveFile.Close()
txtDisplay.Modified = False
End If
End Sub

Shared Sub SaveAs(txtDisplay As TextBox)
Dim SaveFileDialog1 As New SaveFileDialog
With SaveFileDialog1
SaveFileDialog1.Filter = "Text Files (*.txt) |*.txt"
SaveFileDialog1.Title = "Save As"
If .ShowDialog = DialogResult.OK Then
EditorForm.DocumentPath = .FileName
Dim SaveFile As New StreamWriter(EditorForm.DocumentPath)
SaveFile.Write(txtDisplay.Text)
SaveFile.Close()
txtDisplay.Modified = False
Dim FileInfo As New FileInfo(EditorForm.DocumentPath)
EditorForm.DocumentName = FileInfo.Name
End If
End With
End Sub
Sh3R3iF 30-Mar-18 4:42am View    
thanks for reply
when i open a file with double click from file explorer and modify, it uses save as not save, i want to overwrite the current loaded file
but
when i open a file from open dialog and modify, and click save... works