Adding the Controls
Click the maximize button on the form displayed (pic1), that will enlarge
the form which is resized to be of a smaller size by default, our application
is going to me in the maximized format, and at design time we need to see the
whole of the form.
(Remember, the maximize button you have to click is on the form, not the Visual
Basic’s IDE). Set the window state property of the form to maximized, and caption
property to ‘Picture Browser’ using the properties pane. Its time now to place
our controls.
As you already know, taking your mouse to a control’s picture will display
the tooltip text with the name of the control. (Refer Pic2 for location of controls).
Place the drive list box to the upper right corner of the form, beneath it place
the directory list box and file list box respectively. In the rest of the left
pane, place the picture box control; resize it to fill the entire space left.
If you have some nice icons in your hard disk, its not a bad idea to change the
default icon to something more meaningful and nice looking, but here we assume
that we are still working with the default icon. Your form should like pic3 by
now: (Note: the big box on the left hand side is the picture box, the length
of the file list box is increased to fill the alignment requirements of our application,
its up to you to size it the way you like, the your aesthetic sense works!).
The space we have left at the bottom is for you to try out some things, example
putting some introductory text of yourself, using the label control. With this
GUI attained, we have completed exterior designing of our application, time now
to wear the cap of interior designer as well!
Firstly, we have to keep in mind that we have ‘not’ changed any of the default
names of controls on our form. Their names are given below:
|
Name
|
Control
|
Drive1
|
Drive list box |
Dir1
|
Directory list box |
File1
|
File list box |
Picture1
|
Picture Box |
These names will be referred in our coding. You can take a test drive if you
like of the current ‘bare’ code less program by pressing F5 or by Run>Start.
What you will see is interesting enough to catch attention. You current path
is the one that is giving the data to all the controls (except the picture one).
The drive and directory of your Visual Basic will appear in drive and directory
boxes, and the files of current directory in the file list box. But, upon changing
the drive in directory box, nothing will happen. Same goes for directory box;
yes, you can change the directories and navigate the directory structure only
of the current drive but file list wont be updated, neither, changing the directory
will result in population of proper directories in directory box. To sum it all,
all the three entities are working entirely on their own, irrespective of each
other’s contents. Our task is to make them ‘realize’ that this is not good!