Hello there everyone!
I'm michael and i'm 16.
I started using VB a couple of days ago and have found it quite an interesting thing to use. i have created my own program (very simple one i might add ) which works as i would like it to. i do however have a few slight problems.

I have added a menu strip bar to my program, added File >new>save etc. and have begun to code it so that the buttons actually work. i have got as far as the Save(/open)FileDialog opening but i don't quite know how to make the rest work. this is the code i have for the save/openFileDialog:

Save:
Code:
SaveFileDialog1.InitialDirectory = "C:\"
SaveFileDialog1.Title = "Save a Text File"
SaveFileDialog1.Filter = "Text Files(*.txt)|*.txt"
SaveFileDialog1.FileName = ""
SaveFileDialog1.OverwritePrompt = True
Open:
Code:
OpenFileDialog1.InitialDirectory = "C:\"
OpenFileDialog1.Title = "Open a Text File"
OpenFileDialog1.Filter = "Text Files(*.txt)|*.txt"
OpenFileDialog1.FileName = ""
OpenFileDialog1.ShowDialog()
I found these codes on a website for saving and opening, but i don't quite know how to incorporate them into what i already have:

To save:
Code:
Dim FILE_NAME As String = "C:\test.txt"
Dim i As Integer
Dim aryText(4) As String

aryText(0) = (start.Text)
aryText(1) = (num1.Text)
aryText(2) = (num1.Text)
aryText(3) = (ans.Text)
aryText(4) = (time.Text)

Dim objWriter As New System.IO.StreamWriter(FILE_NAME)

For i = 0 To 4
objWriter.WriteLine(aryText(i))
Next

objWriter.Close()
As i understand, this would save the file as "text.txt"? however i would have liked the user to be able to name the file themselves, hense the first code i posted. i also understand that this code writes the text on different lines? this is important because my form has various text boxes so the different lines need to go in the correct boxes.

To OpeN:
Code:
Dim FILE_NAME As String = "C:\test.txt"
Dim TextLine As String

If System.IO.File.Exists(FILE_NAME) = True Then

Dim objReader As New System.IO.StreamReader(FILE_NAME)

Do While objReader.Peek() <> -1
TextLine = TextLine & objReader.ReadLine() & vbNewLine
Loop

Textbox1.Text = TextLine

Else

MsgBox("File Does Not Exist")

End If
again, does this specficially open "test.txt" and how do i get around this?

Apologies for the extremely long post and many thanks to anybody that can help me!

Regards
Michael