Monday, March 30, 2009

vb.net open dialog box

The Open File Dialogue Box
In most programmes, if you click the File menu, and select the Open item, a dialogue box is displayed. From the dialogue box, you can click on a file to select it, then click the Open button. The file you clicked on is then opened up. We'll see how to do that from our menu. (Except, the file won't open yet - only the dialogue box will display, and then name of the chosen file. You'll learn how to open files in a later section.)
First, place two textboxes on your form. In the properties box, locate the MultiLine property. It is set to False by default (which is why you can't change the height of textboxes). Change this value to True.
Type some default text for the Text Property of textbox1. Change the Font size to 14 points.
We'll work with these textboxes when we do the Edit menu. So let's leave them for now.
When we click on File > Open from our menu, we want the Open dialogue box to appear. This is fairly straightforward in VB.NET. In fact there is even a control for it!
Open up your toolbox, and locate the control called "OpenFileDialog". You might have to scroll down to see it.

No comments:

Post a Comment