Fairly new at this and am using visual Studio 2008.
I am putting together my first little program and these are the issues I am running across during debug:
NotePad..the notepad that I put in I installed the OpenFileDialog Contoller..
in debug, the Open Option works and it will allow me to choose a txt doc..but on the Notepad, the file txt file that I chose for it to open- appears on my notepad as a bunch of blocks :(.
This is the code I have:
Private
Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
'Check if there's text added to the textbox
If TextBox1.Modified Then
'If the text of notepad changed, the program will ask the user if they want to save the changes
Dim ask As MsgBoxResult
ask = MsgBox(
"Do you want to save the changes", MsgBoxStyle.YesNoCancel, "Open Document")
If ask = MsgBoxResult.No Then
OpenFileDialog1.ShowDialog()
TextBox1.Text =
My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
ElseIf ask = MsgBoxResult.Cancel Then
ElseIf ask = MsgBoxResult.Yes Then
SaveFileDialog1.ShowDialog()
My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, TextBox1.Text, False)
TextBox1.Clear()
End If
Else
'If textbox's text is still the same, notepad will show the OpenFileDialog
OpenFileDialog1.ShowDialog()
TextBox1.Text =
My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
End If
End Sub
I am wondering if anyone can tell me why or what I am doing wrong?
Do I need to maybe change some application settings on the OpenDialog1 Properties Box?? as I have left all of that at default..