Tutorial Level: Beginner : OpenFile/SaveFile dialogues.
In almost EVERY program out there, the user opens a file for editing, changing, or anything else, this is what we will be discussing today.
1.) Add two buttons to your form, and a textbox, in textbox, click on it, then click the little arrow, and mark multi-line.
2.) Now double-click button1, this is the OpenFileDialog. Type code:
We have now set a variable, "OpenFileDialog1" As an openfiledialog, where a user can select a file.
3.) Now lets play with the properties of this (it will be addressed by variable name "OpenFileDialog1")
What this does, is set the filename to empty so that the user can select his own file.
This sets the title of the dialog.
This will make it so that only Text Files may be selected.
Shows the Dialog.
Now I initially planned to go into reading the text file, but not now.
If you don't want to declare the dialog as a variable, you can simply add it to your form.
Add an OpenFileDialog to your form from your ToolBox, and use the same code, except for the
Dim OpenFileDialog1 As New OpenFileDialog
Leave that out.