PDA

View Full Version : [vb6]Tutorial 2


Darkchild
08-11-2007, 09:26 PM
Well, here is the tutorial as I promised!

Today we are going to learn about the VB6 GUI!


Q: What on earth is GUI?
A: GUI stands for Graphical User Interface

Q: How does the VB6 GUI look like?
A: Here's a screenshot:

2581 (Yes, this is THE madamp5 project )

As you can see, there are lots of buttons! And windows and information, What are these for? You're going to learn MOST of them today!

Well...As you can see in the image above, there is a graphical interface designer, where you can put buttons, labels, and etc.. (which we will talk about later on). The window you design in VB is called a FORM.

On the right of the window(the one that has a form) there is a CODE WINDOW


--------VERY IMPORTANT---------

Note : Visual Basic 6 is a event oriented programming language, so, certain things ONLY happen when you press a button or...move the mouse... Etc...

--------VERY IMPORTANT---------

Now the objects!
2582
As you can see there are loads and loads of possible objects in visual basic!
and now I will explain the use of ALL of them!
(from left to right)

2556 First there's the mouse cursor, used for moving/resizing objects.

2557 next there's the picture box, which is used to show pictures on VB6. (and sometimes for arrays) This component is more advanced than the image component, because it has more functions, let's say it's a Image V2.0 :P


2558 next there's the label box (Appears as a big "A") this is used to display text with no borders and can have fonts and colors of all type!

2559 next there's the TextBox, this object is for the user to input data or the program to export data, for example, if you want to make a login screen you need the textbox to write the PASSWORD (one of the proprieties of this object is PasswordChar, which is the character he'll show instead of the normal text! Object Proprieties will be explained later!)

2560next there's the frame, this has no particular usage, except for better organizing your program or making it look more professional!

2570 And now my favorite object! The command button!!! I love this thing!
It is a button, that's it! You press it, code is executed!:P (I love buttons xD)

2561Now for the checkbox...I think you all know what this is for, you can read/set it's values and it is like a boolean, it can be only true or false (1 or 0 in value)

2562The option button! as you all know Option buttons allow you to ONLY BE ABLE TO SELECT ONE ITEM, so in each form... you can ONLY have one option for a set of option buttons (this is automatic, by inserting them in a form, they will automatically start working, in a sense that, if you select one, all the others will be deselected!)

2563The combo box! What is it? I think this screenshot can explain it :
2577

2564The listbox! This is a component used for making lists, you can edit/read/add all /alues on the list, can be used for storage of information (Still, variables are safer xD)

25652566 I personally never used these, they are for "scrolling" OR another use for them is adjustable progress bars (in the old days [windows 3.1 days that is] these were commonly used for adjustable progress bars in media players :) )

2567Let's imagine you want something to occur every...let's say...500 milliseconds, it's by using this timer that you will get there!
there are 2 key proprieties in this component which are:
-Interval
-Enabled
in interval, you input the amount of milliseconds you want the timer to execute it's code and in Enabled is if it will keep looping the code or not.

2568Drive list box, a very easy way to get a list of all drives on a computer! :D it works as a combo box, and as a list at the same time, but values cannot be altered! :O This component is "Read Only" if ya know what I mean xD

2569Another great component, Dir List box, This can be used for old school file browsing/file "recon" :) and as the drive list box, it's read only

2572File List Box, same as Drive List or DirList it's a list of files bla bla bla read only bla bla bla...

---VERY IMPORTANT!----

NOTE : YOU MUST INPUT WHICH DIRECTORY TO USE IN DIR/FILE LIST BOX!! AND THEN RUN ITS INTERNAL REFRESH FUNCTION!

---VERY IMPORTANT!----

2573 You can make shapes on your App, good for decoration, you can make circles, squares, rectangles, etc..!

2574 You can make lines too and change their position/look/direction in code, which may be useful!

2571 Image, simply for imagery, supports strech too! (and gif (non animated), BMP, WMF, jpg)

25752576 These two... I never used them xD OLE is for objects and the other one for databases :)


Now...WHAT ARE COMPONENTS!

Components are the various "objects" you can put on your program, be it an image, a label, a button, whatever! these are components!

Q: Are these the only ones I can use? :S there's not that many of them....

A: No, fortunately there are more, but there's a catch...For aditional components, you need the corresponding OCX file, if you put that program on a computer that doesn't have the required OCX files, the program WILL NOT RUN!
so be carefull using these!

Now, how to add them:


All you need to do is go to the menu bar and select "project" then components like so :
2578

and this window should appear:
2579

now just select what you want, press apply and tadaah!
2580
new things!!! :O


Well then, that's all for today (Omg!! so many pics and text!!!)

Hope you liked it, be sure to post your questions, if any :)

roe-ur-boat
08-11-2007, 09:34 PM
Nice man all I need now is the GUI. xD

Darkchild
08-11-2007, 09:38 PM
What? you still don't have VB6? XD

roe-ur-boat
08-11-2007, 09:48 PM
Nope Im going to the internet cafe sometime next week. But I want to be prepared to know what to do when i get it

Darkchild
08-11-2007, 10:12 PM
ok :)

I'm going to wait a week for the questions, I'll then make the third :)

Junit
08-13-2007, 03:25 AM
I still need to get VB6 also LOL , thanks for taking the time and making the guides :)

roe-ur-boat
08-17-2007, 01:38 PM
Ok I got VB6 today. Wheres the next tut :D

Darkchild
08-18-2007, 01:44 AM
remember the rules :P 3+ people have to request it

Acerthief
08-18-2007, 08:17 AM
i've got vb6 decades ago. waiting for the next tut!!

roe-ur-boat
08-18-2007, 09:06 AM
There you go DC, 3 people.

Darkchild
08-18-2007, 01:19 PM
ok, today I'm going to a marriage, later on or tomorrow you will have the new tutorial! :D

EvilSeph
11-06-2007, 05:43 AM
Excellent, lesson 2. As always, corrections or comments are in line and in red:
Well, here is the tutorial as I promised!

Today we are going to learn about the VB6 GUI!


Q: What on earth is GUI?
A: GUI stands for Graphical User Interface

Q: How does the VB6 GUI look like?
A: Here's a screenshot:

2581 (Yes, this is THE madamp5 project )

As you can see, there are lots of buttons! And windows and information, What are these for? You're going to learn MOST of them today!

Well...As you can see in the image above, there is a graphical interface designer, where you can put buttons, labels, and etc.. (which we will talk about later on). The window you design in VB is called a FORM.

On the right of the window(the one that has a form) there is a CODE WINDOW

You should include instructions on how to access said Code Window.

--------VERY IMPORTANT---------

Note : Visual Basic 6 is a event oriented programming language, so, certain things ONLY happen when you press a button or...move the mouse... Etc...

In theory most programming languages are event oriented. Visual Basic just uses this idea more explicitly. Stating that things only happen if you or the user does something is misleading as this is not always the case.

--------VERY IMPORTANT---------

Now the objects!
2582
As you can see there are loads and loads of possible objects in visual basic!
and now I will explain the use of ALL of them!
(from left to right)

You should probably mention that this is called the Tool Box.

2556 First there's the mouse cursor, used for moving/resizing objects.

2557 next there's the picture box, which is used to show pictures on VB6. (and sometimes for arrays) This component is more advanced than the image component, because it has more functions, let's say it's a Image V2.0 :P

Both have their advantages and disadvantages but I suppose that is too advanced for this tutorial to cover. It would be interesting to see if you possess this knowledge though.

2558 next there's the label box (Appears as a big "A") this is used to display text with no borders and can have fonts and colors of all type!

Not always the case, you can add borders etc. (to most objects, actually). But again, probably too advanced for this tutorial to cover.

2559 next there's the TextBox, this object is for the user to input data or the program to export data, for example, if you want to make a login screen you need the textbox to write the PASSWORD (one of the proprieties of this object is PasswordChar, which is the character he'll show instead of the normal text! Object Proprieties will be explained later!)

Very nice point to be brought up.

2560next there's the frame, this has no particular usage, except for better organizing your program or making it look more professional!

I disagree with this point. The frame is more useful than people think. I think I seriously need to decide how advanced this tutorial should be...

2570 And now my favorite object! The command button!!! I love this thing!
It is a button, that's it! You press it, code is executed!:P (I love buttons xD)

To think a command button is simply limited to the functionality of a button is silly :P. You can do so much more with it.

2561Now for the checkbox...I think you all know what this is for, you can read/set it's values and it is like a boolean, it can be only true or false (1 or 0 in value)

2562The option button! as you all know Option buttons allow you to ONLY BE ABLE TO SELECT ONE ITEM, so in each form... you can ONLY have one option for a set of option buttons (this is automatic, by inserting them in a form, they will automatically start working, in a sense that, if you select one, all the others will be deselected!)

This is one of the times where frames come in handy. They allow you to seperate option button groups.

2563The combo box! What is it? I think this screenshot can explain it :
2577

How come you left this explanation out? Do you not understand what a combo box is? Or do you feel it is too advanced for this tutorial? (I'm trying to get a grasp on how advanced your skill with and knowledge of Visual Basic is.)

2564The listbox! This is a component used for making lists, you can edit/read/add all /alues on the list, can be used for storage of information (Still, variables are safer xD)

Safer is not a word I'd use here. Perhaps you should go into detail as to the difference between variable storage and listbox storage...

25652566 I personally never used these, they are for "scrolling" OR another use for them is adjustable progress bars (in the old days [windows 3.1 days that is] these were commonly used for adjustable progress bars in media players :) )

Scroll bars rock!

2567Let's imagine you want something to occur every...let's say...500 milliseconds, it's by using this timer that you will get there!
there are 2 key proprieties in this component which are:
-Interval
-Enabled
in interval, you input the amount of milliseconds you want the timer to execute it's code and in Enabled is if it will keep looping the code or not.

Perhaps you should educate the user as to what a millisecond is. Your explanation for Enabled is sketchy.

2568Drive list box, a very easy way to get a list of all drives on a computer! :D it works as a combo box, and as a list at the same time, but values cannot be altered! :O This component is "Read Only" if ya know what I mean xD

2569Another great component, Dir List box, This can be used for old school file browsing/file "recon" :) and as the drive list box, it's read only

2572File List Box, same as Drive List or DirList it's a list of files bla bla bla read only bla bla bla...

---VERY IMPORTANT!----

NOTE : YOU MUST INPUT WHICH DIRECTORY TO USE IN DIR/FILE LIST BOX!! AND THEN RUN ITS INTERNAL REFRESH FUNCTION!

---VERY IMPORTANT!----

2573 You can make shapes on your App, good for decoration, you can make circles, squares, rectangles, etc..!

2574 You can make lines too and change their position/look/direction in code, which may be useful!

2571 Image, simply for imagery, supports strech too! (and gif (non animated), BMP, WMF, jpg)

25752576 These two... I never used them xD OLE is for objects and the other one for databases :)


Now...WHAT ARE COMPONENTS!

Components are the various "objects" you can put on your program, be it an image, a label, a button, whatever! these are components!

Q: Are these the only ones I can use? :S there's not that many of them....

A: No, fortunately there are more, but there's a catch...For aditional components, you need the corresponding OCX file, if you put that program on a computer that doesn't have the required OCX files, the program WILL NOT RUN!
so be carefull using these!

Now, how to add them:


All you need to do is go to the menu bar and select "project" then components like so :
2578

and this window should appear:
2579

now just select what you want, press apply and tadaah!
2580
new things!!! :O


Well then, that's all for today (Omg!! so many pics and text!!!)

Hope you liked it, be sure to post your questions, if any :)

Nice work. I should have noted this before though: include a subtitle when naming your tutorial so that we know what each tutorial will cover.

I realise I may be including corrections or comments that might be too advanced for this tutorial to cover, but I'm not just editing these tutorials for that purpose. I am editing them because I'd like you to learn from them too.

Ultimately, good tutorial though some things could have been better written and gone into further detail on.

You've also included some things that may be too advanced for a beginner programmer to use, but that's just my opinion.

Darkchild
11-06-2007, 05:55 PM
No offense evilseph, but..seeing all those corrections (and don't take this the hard way) why don't you make your own tutorials?

Not only you'd save me a lotta work but the people would seem to understand you better

EvilSeph
11-06-2007, 10:52 PM
I've moved on from Visual Basic and seeing these tutorials brought back memories and was a nice refresher.

The main reason why I am correcting your guides is because guide writers obviously want to learn more about the subject they write about (and to teach something is the best way to learn something). By correcting your guides I am re-enforcing my knowledge on the subject, teaching you and anyone else who may read the guide and helping you (the guide writer) further improve their learning.

I apologise if I offended you in any way. I just felt like you wanted to learn and so I tried to make sure you were learning the best way possible and that what you were learning was correct.

Where did you learn how to program Visual Basic?

Darkchild
11-07-2007, 08:57 AM
A little bit here..a little bit there... XD and most of it by practising and finding things out ;)