G
GJP
Hello.
Ive been asked to make my own notepade for college assignment.
All ig going well, but i cant get the save to work.
I can get Save a (shows dialog box), i can get it to just save too, but when
i try to put an IF in it to check if the file has already been saved before,
it will not save.
Private Sub mnuSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuSave.Click
'fname is a var, set it to file name
fname = SFD.FileName()
If fname > "0" Then
'save the file will current name
rtb1.SaveFile(SFD.FileName, RichTextBoxStreamType.RichText)
Else
'need to do a save as if got this far
'title box
SFD.Title = "Please chose a folder and a name for your file"
'rich text format
SFD.Filter = "Rich Text Files (*.rtf)|*.rtf"
SFD.FilterIndex = 1
result = SFD.ShowDialog
If result = DialogResult.OK Then
rtb1.SaveFile(SFD.FileName, RichTextBoxStreamType.RichText)
fname = SFD.FileName
End If
End If
End Sub
Any ideas? Thanks!
Ive been asked to make my own notepade for college assignment.
All ig going well, but i cant get the save to work.
I can get Save a (shows dialog box), i can get it to just save too, but when
i try to put an IF in it to check if the file has already been saved before,
it will not save.
Private Sub mnuSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuSave.Click
'fname is a var, set it to file name
fname = SFD.FileName()
If fname > "0" Then
'save the file will current name
rtb1.SaveFile(SFD.FileName, RichTextBoxStreamType.RichText)
Else
'need to do a save as if got this far
'title box
SFD.Title = "Please chose a folder and a name for your file"
'rich text format
SFD.Filter = "Rich Text Files (*.rtf)|*.rtf"
SFD.FilterIndex = 1
result = SFD.ShowDialog
If result = DialogResult.OK Then
rtb1.SaveFile(SFD.FileName, RichTextBoxStreamType.RichText)
fname = SFD.FileName
End If
End If
End Sub
Any ideas? Thanks!