ويب صور الأخبار مجموعات ترجمة إجابات Gmail المزيد »
المجموعات التي قمت بزيارتها مؤخرا | مساعدة | تسجيل الدخول
الصفحة الرئيسية لمجموعات Google
رسالة من مناقشة Fwd: VB5, VB6 & VB7

تم تحليل العرض - إظهار نص الرسالة فقط

Received: by 10.11.88.14 with SMTP id l14mr1753654cwb;
        Wed, 22 Feb 2006 05:15:20 -0800 (PST)
Return-Path: <vittal...@gmail.com>
Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.192])
        by mx.googlegroups.com with ESMTP id v23si1812841cwb.2006.02.22.05.14.02;
        Wed, 22 Feb 2006 05:14:04 -0800 (PST)
Received-SPF: pass (googlegroups.com: domain of vittal...@gmail.com designates 64.233.184.192 as permitted sender)
DomainKey-Status: good (test mode)
Received: by wproxy.gmail.com with SMTP id 71so1363180wra
        for <rnsitvb@googlegroups.com>; Wed, 22 Feb 2006 05:14:02 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws;
        s=beta; d=gmail.com;
        h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references;
        b=hpmuz/oL8n5qzyqb8bolDHntQo8Xdvq2BfAFDaIYWWuyYQoK5fnNFqQ5kiOGfnp3axyCWoEkW/PcmAwtYHk0TCTOk05U6MYdRG3QuldzGgzoKCt5vbSkJL4EqG6zIoXYGww5avgxzJGEnLImiI6ZRgydBn0GodPzEnNT8bzNhEU=
Received: by 10.54.66.14 with SMTP id o14mr6204728wra;
        Wed, 22 Feb 2006 05:14:01 -0800 (PST)
Received: by 10.54.70.14 with HTTP; Wed, 22 Feb 2006 05:14:01 -0800 (PST)
Message-ID: <d8910e430602220514g1e3e85ebyfb120115a32303b9@mail.gmail.com>
Date: Wed, 22 Feb 2006 18:44:01 +0530
From: Vittal <vittal...@gmail.com>
To: "RNS VB GROUP" <rnsitvb@googlegroups.com>
Subject: Fwd: VB5, VB6 & VB7
In-Reply-To: <20060222063802.10381.qmail@web8501.mail.in.yahoo.com>
Mime-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_Part_10112_9058871.1140614041345"
References: <20060222063802.10381.qmail@web8501.mail.in.yahoo.com>

------=_Part_10112_9058871.1140614041345
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

---------- Forwarded message ----------
From: vittal <vittal...@yahoo.co.in>
Date: Feb 22, 2006 12:08 PM
Subject: VB5, VB6 & VB7
To: Vittal P <vittal...@gmail.com>

  Profsr.com <http://profsr.com/>



[image: Previous page] Previous
<http://www.profsr.com/vb/vbless04.htm>     [image:
TOC] Contents <http://www.profsr.com/vb/vbintro.htm#content>     [image:
Next page]Next <http://www.profsr.com/vb/vbless06.htm>

 ------------------------------
 LESSON 5 -- More standard controls



Working with arrays Before we get to today's lesson we will cover a bit of
programming theory on Arrays.
In VB, arrays work in much the same way as they do in all other languages
you have studied. By definition an array is *an indexed variable*, meaning
it is one variable with many parts, each part being referenced by an index
number. The index number being numeric, it can be manipulated by loop
statements, incremented, decremented, etc. An array can contain any valid
data type and, if it is of the Variant type, can even contain elements of
different types.
An array is declared like any other variable, with the addition of an index=
:

* Dim Department(6) As String
*
will declare an array of 7 elements of the String type (we assume that it
will be 7 Department names). The only problem with this declaration is that
the index goes from 0 to 6. So, if you want the name of the sixth Departmen=
t
you have to specify Department(5), which can be confusing at times.
To work around this problem you can specify the starting index in the
declaration:

*Dim Months(1 To 12) As String*

Thus, Months(1) is January and Months(12) is December.
You don't even have to start at 1. If your Sections are numbered 101 - 120
you can define an array:

*Dim Sections(101 To 120) As Integer*



One common method of manipulating arrays is to use For...Next loops:



An array can also be assigned to a variable in code. Look at the following
example and understand that that is *not an implicit declaration*. The
variable "Week" is declared as Variant. It is assigned an *array value* in
code.



Now, when we get to the next set of controls, different kinds of Lists,
these notions may prove useful.


Top <http://www.profsr.com/vb/vbless05.htm#Start>









ListBoxWith the ListBox control the user can select items from a list of
choices. Although the list of choices can be entered in the List property o=
f
the control, as in the example below, this is not a very good habit to get
into. It is essentially "hardcoding" data into the program and it can cause
maintenance headaches.



The common technique for loading a ListBox is to do it in code, with the
Form_Load event. This way, if items have to be added it is a simple matter
to add a line of code.



   It is sometimes difficult to distinguish an object's Properties and its
Methods. In the example above we used lst_team.AddItem. What is AddItem? It
is a Method. How do I know? Well, to tell them apart, think of grammar. A
property is a characteristic, something that the object is, a color, a size
- it is like an adjective. A Method is an action, something that it does, i=
n
fact, a verb. When you see object.something_descriptive, it is a Property.
When you see object.some_action, it is a Method.



In the example shown, *AddItem is a Method *because it is the action of
adding items to the ListBox.
If you wanted to remove an item from the list in code, there is a *RemoveIt=
em
Method* for the ListBox. lst_team.RemoveItem 2 would remove the 3rd team -
remember that it starts at 0.
When the Form opens, it will load the list in Form_load before the ListBox
is displayed. If there are too many items for the space allocated to the
ListBox, it will create a vertical scroll bar.
When the user selects one of the teams from the list, we have to have a way
of capturing that information in a variable. That is done with the Text
property of the ListBox: *TeamName =3D lst_team.Text*
ComboBoxThe ComboBox is called that because it's a combination of a ListBox
and a TextBox. It has the advantage over the ListBox of not taking up space
until it is actually used which means that it makes it easier to position o=
n
the Form.
But the combo has the disadvantage, sort of, that the user can enter his ow=
n
information, in addition to what is in the list. This may make data
validation harder because the choices are not limited. When you want to
force the user to make a choice only among the specified items, use a
ListBox, even if it is a bit more awkward. If the user is allowed to
override the choices, uses a ComboBox.
As in the ListBox, use the *Text* property to get the information input. *
Label3.Caption =3D cbo_position.Text*






As you can see, it is fairly simple to load the ListBox and the ComboBox
during the From_Load event. The only other detail to note is that the order
in which the items appear in the Combo is not the same as the order in whic=
h
the items were added. That is intentional - it is done with the
*Sorted*property for the ComboBox. It can also be done for the
ListBox.


Top <http://www.profsr.com/vb/vbless05.htm#Start>





DriveListBox, DirListBox, FileListBoxFor this next example we need to creat=
e
a new form, Form2, in the current Project.

*Specifications:* While in Form1, the Registration form, we need to be able
to hit a button which will call-up a new form, the DirList form, which will
look like the example below. This form will allow us to select a type of
file that we want to see and then to select a file, in a directory, in a
drive that will be specified. If the file selected is an executable, we wil=
l
run the file. If it is a text file we will call-up Notepad to edit it, and
if it is a graphics file we will call-up the image editor.
In fact, this allows us to call an external program from inside a form. If,
for example, we wish to edit the player's picture before storing it, we can
open the picture file with the image editor, change it, and continue with
the rest of the form.



There are 3 new controls on this form, plus the buttons and the ListBox.
Since you almost always have only one of each of those controls on the form=
,
we won't bother to change the names of the controls in this example - we
keep them as: Drive1, Dir1, and File1.

The control that shows the current drive is called a *DriveListBox*. The
name of the active drive is in the control's *Drive* property. The selected
drive can be changed, in code, by writing: *Drive1.Drive =3D "D:"*, for
example.

   Don't bother looking for the .Drive property in the Properties window fo=
r
Drive1 - you won't find it. Same with Dir1.Path and List1.FileName. That's
because Drive is a runtime property. That is, one that is only available
when the program runs. Makes sense when you think about it. You can design
the DriveListBox to have the size, the color and the font you want but you
can't tell it which drive will be active at runtime. That will have to come
from the system.
VB is full of these details. Every control has properties that are only
accessible at runtime, through code. The only way to find them is to look i=
n
the documentation. A big Reference Manual is handy and the Help function
helps a lot with this, too.


The current directory is in the *DirectoryListBox*. The name is in the *
Dir1.Path* property.

The default event associated with Drive1 and Dir1 is called a
*Change*event. That's because nothing has to be done with those
controls until they
are actually changed. Remember, when the program runs they are automaticall=
y
loaded with the current drive and the current directory active.

The current file selected is in the *FileListBox*, in the
File1.FileNameproperty. This one is not automatically loaded because
there is no current
active file. You select a file by clicking on it, generating a *Click*event=
.

Study the code and then look at the explanations below. To keep the code
section from getting too long, explanations have not been included as
comments.







Program notes:

   - First task in Form_Load is to load the list of file types. We only
   want to display files that are Executable, Text or Graphics. The .EXE is
   selected by default - ListIndex =3D0.

   - The FileListBox *Pattern* property creates the filter for the
   selection.

   - Whenever we change the Drive selection or the Directory selection, a
   *Change event* is generated. When the Drive changes, the Directory's
   path changes and when the Directory changes, the list of files changes.

   - When you click on the Start button you first have to check if a file
   is selected. If not, issue a message.

   - The Right() function, which we will look at in Lesson7, checks to
   see if the rightmost character of the filename is a \. If it is it means
   that the file is in the root directory. If it isn't, we have to add a \
   between the path and the filename.

   - Based on the type of file selected, we execute the *Shell
function*which runs an executable program. vbNormalFocus is the
   *window style argument* that tells the program to run in a normal
   window.

   - When we click on a file type, the Pattern property for the FieList
   must change.

   - A double-click on a filename does the same as hitting the Start
   button.

   - Remember, we called this Form from the Registration form. When we're
   done with this, we want to close it and go back to the calling form. The
   Exit button does an *Unload* of the current form but, *it does not
   execute an End statement* because that would cause the Project to end.


This final section of code is in the Registration form. It is the code for
the Viewer button which calls the DirList form.

The only thing to do is to Load the form using its FormName (from the Name
property) and then to execute its *Show method*. The argument
*vbModeless*means that the form does not get exclusive focus. The
opposite of vbModeless
is *vbModal*. A *modal* form is one which requires action from the user
before it can be closed. Usually, error messages are modal - you have to
respond, usually by hitting the OK or Cancel button, and you can't click on
another form to send this one to the background, and you can't close it wit=
h
the close box. A *modeless* form can be sent to the background and it can b=
e
closed at any time.










 ------------------------------


Top <http://www.profsr.com/vb/vbless05.htm#Start>



Home <http://www.profsr.com/>               =20
Tutorials<http://www.profsr.com/home3.html>


  Profsr.com <http://profsr.com/>



[image: Previous page] Previous
<http://www.profsr.com/vb/vbless05.htm>     [image:
TOC] Contents <http://www.profsr.com/vb/vbintro.htm#content>     [image:
Next page]Next <http://www.profsr.com/vb/vbless07.htm>

 ------------------------------
 LESSON 6 -- Menu and Debug







Creating a Menu No! Not a restaurant menu.

If you've worked with Windows applications before you have worked with
menus. Every Windows application has one. The menu gives the users access t=
o
functions that are not defined as controls (editing, formatting, etc) and
also repeats certain functions that are coded as controls (Exit button, for
example). Menus offer a variety of functionalities to define the
application: we can include sub-menus, checked items, enabled/disabled
functions, toolbar icons. The VB IDE that you are using certainly displays
all of those tools, as in the diagram below.









For this lesson, we will use the Registration form we created in Lesson 5
and we will add a menu to it.

The easiest way to create a menu is to do it with the Application wizard
when creating the application. But since we're not here to do things the
easy way, we'll have to rough-it. In this case, roughing-it is not much
harder. We use the *Menu Editor* that can be found in the Menu bar -->
Tools. Using the Editor is fairly obvious. We just build up the menu bar on
the first level and then, we add sub-menus using the arrow keys to add an
elipsis before the captions. Thus, &File is on the menu bar and ...&Open is
under &File. Items can be inserted anywhere using the Insert button.

You may have noticed the use of the ampersand (&) in the captions (the *
Caption* is the part that will display in the menu bar, not the name). That
is standard Windows practice. It creates a Hot-key, meaning a function that
can be called from the keyboard using the <Alt> key. Putting an & before a
letter in a caption makes that letter the hot-key for the function; <Alt><F=
>
will call-up File, <Alt><E> will call-up Edit, and so on. Just make sure
that the same hot-key is not used for 2 functions on the same level. In the
menu bar for VB above, note that <Alt><F> is used for File but, <Alt><o> is
used for Format. The hot-key for each function is the letter underlined so
there should'nt be any confusion.

The other consideration when creating the menu is to give each menu item a
specific *name*. In this case we use the prefix mnu_ to identify menu items=
.
These are important because they will be refered to in code and it should b=
e
clear that mnu_exit is the Exit function in the menu whereas cb_exit is the
Exit command button.



You can run the application at any time while you create the menu, just to
verify that it displays correctly. Of course, if you click on a menu item,
nothing happens. Just like controls, menu items have to be coded to work.
So, we go to the code window and write the code for each of the menu items
that we want to activate. Fortunately, some of it is automatic. Clicking on
a menu item will automatically open lower-level items, if there are any. We
just code for the lowest-level item. For example, for File-->Open-->Viewer,
there is no code for File, nor for Open but, we must write the code to
execute for when Viewer is clicked.

For this example we will code a few simple operations to show how it is
done. From this it is just a question of expanding the menu to display more
functions.



When working with forms, there is always a certain amount of data validatio=
n
that has to be done. Data validation consists of making sure the data is
correct before doing calculations and so on. Usually, until the data is all
correct certain functions such as calling the database or going to the next
form have to be made unavailable - we say that the function is *disabled*.

To complete the example, let's say that we want to disable the Viewer optio=
n
if the player's name has not been entered. To do this we add some code in
the Go button. The code consists of setting the *Enabled property to
False*if we want to disable a control or menu item; we set the
property to True to
enable the control again. When disabled, the Caption goes gray and the code
cannot be executed. In the case of Viewer, where we have both a button and =
a
menu function, we must remember to disable both.




Top <http://www.profsr.com/vb/vbless06.htm#Start>









Debugging codeAfter six lessons of this tutorial, it would be surprising if
you had never had a bug in the code you've been writing. By now you should
have written some original code for yourself, not just the examples supplie=
d
with the lessons. Whenever you write code there is the possibility of makin=
g
mistakes. Heck! even Professors make them, although very rarely. It can be
very frustrating to try to find an error when you don't know where to begin
to look. But there are techniques that can help.

   Do you know where the term "*bug*", for a program error, comes from? In
case you've never heard the story before, here it is, as told by Grace
Hopper, one of the pionneers of programming.
In the late 40's even a simple computer was a big thing: 1000's of vacuum
tubes and 1000's of square feet of floor space. A group of programmers were
working late one hot summer night. To help to dissipate all the heat
generated by those tubes, all the windows were open. At one point the
program that they were working on bombed-out. Eventually they found the
problem: a moth had flown in and had become lodged in the wiring, creating =
a
short-circuit. Afterwards, every time a program would crash the programmer
would exclaim, "There must be a bug in the machine!". To this day that has
remained one of the mainstays of programmers: when the program goes wrong,
blame the hardware!








One of the first techniques to master is the use of *breakpoints.* A
breakpoint is a flag at a given point in code where program execution will
be suspended to give you time to look at the content of variables or at the
status of properties. When VB hits a breakpoint when running a program, the
code window opens and an *immediate window* opens at the bottom of the
screen. You can look at variables or properties in the immediate window and
then, either do *Start* to resume execution or do *Step*, using *<F8>* to
step through the execution, one statement at a time.

Again we will use the code from Lesson 5. In the code window, click the
column to the left of a line of code. This will create a breakpoint
indicated by a red dot (you remove the breakpoint by clicking on the red
dot). When you run the program it will stop at the breakpoint. In the
immediate window, look at the content of different variables or properties.
Step through the code with <F8>; the active statement is indicated by the
yellow arrow. All the logic represented by IF or LOOP or DO statements will
be executed according to the conditions present. If the yellow arrow jumps
to a line that you don't expect, find the reason why.



Another technique to learn is called *"error trapping"*. It consists in
intercepting errors that can occur at execution rather than programming
mistakes, although not providing for user errors can be considered a
programming mistake.

Let's build a simple example. The user will input 2 numbers, a numerator an=
d
a denominator. The program will divide the numerator by the denominator and
display the result. Easy so far. However, if the user inputs 0 for the
denominator, the program crashes because programming cannot make sense of
division by zero. So, we want to *trap the error* and process it before it
displays an error message to the user. We will use the *On Error GoTo
... *statement.
This tells the program that if there is some kind of run-time error, go to
the error-processing-routine named. We have to create a *line label* to
identify the error routine; a line label has a colon at the end, like
error_rtn:, in the example. At the same time, there is an *Err
object*created and it contains, among other things, a
*Number property* that will identify the error. For example, if Err.Number =
=3D
11, the error was a division by zero; Err.Number =3D 6 represents an overfl=
ow
situation.

It is worth noting that line labels in code do not end processing in any
way. When the logic gets to a line label it keeps on going. The programmer
has to make sure that the processing of errors in the error_rtn is not done
automatically every cycle (that is called "falling through" the next routin=
e
and it's a common error).










 ------------------------------


Top <http://www.profsr.com/vb/vbless06.htm#Start>



Home <http://www.profsr.com/>               =20
Tutorials<http://www.profsr.com/home3.html>


  Profsr.com <http://profsr.com/>



[image: Previous page] Previous
<http://www.profsr.com/vb/vbless06.htm>     [image:
TOC] Contents <http://www.profsr.com/vb/vbintro.htm#content>     [image:
Next page]Next <http://www.profsr.com/vb/vbless08.htm>

 ------------------------------
 LESSON 7 -- Text, Graphics and Multimedia



Manipulating text Whenever you are entering data, creating files or
databases, you are working with text strings. Text strings contain
characters that can be copied, deleted, cut and reassembled but they also
have important visual characteristics: size, color, weight, transparency,
etc. In this lesson we will look at different ways of manipulating those
text strings.

String functionsHere is a list of the basic functions that work with
strings:


   - *Len(string)*: returns the length of *string*, the number of
   characters it contains.

   - *Left(string, number)*: returns the number of characters specified
   by *number* from the left end of *string*.

   - *Right(string, number)*: returns the number of characters specified
   by *number* from the right end of *string*.

   - *Mid(string, position, number)*: returns the number of characters
   specified by *number* starting at character number *position* from the
   left end of *string*.

   - *InStr(string1, string2)*: returns the position of *string2* in *
   string1* - returns 0 if *string2* is not found in *string1*.

   - *LTrim(string), RTrim(string) and Trim(string)*: returns
*string*with non-significant spaces removed from the left, the right
or both,
   respectively.

   - *LCase(string), UCase(string)*: returns *string *converted to
   lower-case or upper-case, respectively.








Formatting Numbers, Dates and TimesThe Label control is still the easiest
way of displaying the result of calculations. Whatever the answer is, just
move it to Label5.Caption and it will appear on the form. Unfortunately, it
does not always appear the way you want to see it. No problem if the result
is a string but, what if it is a dollar amount or a date of some kind. That
will require some formatting of the result before displaying it. We use the
*Format function*: *Label5.Caption =3D Format(result, "formatting character=
s")
*

NumbersFor example, given that:
        *Dim result As Single

        result =3D 3456.7

        Label5.Caption =3D Format(result, "00000.00")          'displays:
03456.70

        Label5.Caption =3D Format(result, "#####.##")          'displays:
3456.7

        Label5.Caption =3D Format(result, "##,##0.00")          'displays: =
3,
456.70

        Label5.Caption =3D Format(result, "$##,##0.00")        'displays: $=
3,
456.70 *

Here is a list of what the formatting characters mean:

   0  represents a digit, with non-significant leading and trailing zeros
#  represents a digit, without non-significant leading and trailing zeros
.  decimal placeholder  ,  thousands separator  $ + - ( ) space  literal
character; displayed as typed


When displaying dollar amounts, it is good practice to always use the 0
placeholder with the decimal so that *10 cents *does not come out as *$.1*o=
r
*$0.1* Using the formatting string *"$#0.00"* ensures that the value follow=
s
standard rules and comes out as *$0.10*.

 Dates and TimesWhen working with dates and times, you need to know that
there is a function that will obtain the current date and time from the
system clock. The function is: *Now( )* and you can use it directly as in: =
*
Label5.Caption =3D Now( )*


The result is the current date and time formatted according to what you
specified in the Windows Control Panel for your system. If you want to
format the result, because you don't want to see the time, for example,
there are formatting characters for date and time, as there are for numbers=
.
The main characters are:

   yy  year without the century - eg: 00  yyyy  year with century - eg:
2000  m  month number - eg: 12  mmm  short name of month - eg: dec  mmmm  l=
ong
name of month - eg: december  d  day of the month, without zero - eg:
8  dd  day
of the month, with zero - eg: 08  dddd  name of the day of the week - eg:
Monday  h  hour, without zero - eg: 7  hh  hour, with zero - eg: 07=20
mm  minutes
- eg: 45 ss  seconds - eg: 55


Thus, if Now( ) is July 8, 2000 , *Label5.Caption =3D Format(Now( ), "dddd,
yyyy mmmm dd")
returns: Saturday, 2000 July 08*


Of course any other date can be formatted for display: *Label5.Caption =3D
Format( DateOfBirth, "yyyy-mm-dd")*


Named FormatsIn addition to the formatting string, there are several *named
formats* that can be used to determine the output format. These named
formats are VB constants that you call when you need them:

   General Number  Number with no thousands separator  Currency  Thousands
separator, two digits to the right of decimal  Fixed  Displays at least one
digit to the left and two digits to the right of decimal  Standard  Thousan=
ds
separator, at least one digit to the left and two digits to the right of
decimal   Percent  Multiplies by 100, add percent sign to the right  Genera=
l
Date  Display determined by Control panel settings; displays date and
time  Long
Date  Long date format specified for system  Short Date  Short date format
specified for system  Long Time  Long time setting specified by system;
includes hours, minutes, seconds  Short Time  Shows hours and minutes




*Dim DateHired As Date
DateHired =3D "1995-10-25"
Label5.Caption =3D Format(DateHired, "Long Date")

returns: October 25, 1995*








Manipulating blocks of textThe *TextBox* and the *ComboBox* controls contai=
n
several properties which will allow you to manipulate blocks of text, in
addition to single characters.

If you have to input a large quantity of text in a TextBox, for example, yo=
u
do not want to see it all in a single line. There are 2 properties that you
set that will make the data easier to see:

   - *MultiLine =3D True* allows you to have several lines of input, all
   separated by <Enter>.

   - *ScrollBars =3D 2 - Vertical* will create scrollbars, useful to read
   text.





Then there are 3 properties to work with a *block of selected text* in the
control:

   - *SelStart* an integer number identifying the start of selected text,
   the position of the first character in the block - starts at 0.

   - *SelLength* an integer number identifying the number of characters
   selected in the block.

   - *SelText* a string containing the selected text.


Note that this kind of manipulation is usually done with the mouse. However=
,
you do not have to code for the mouse events. It is automatic - when you
select text in a control, the appropriate events, MouseDown, MouseUp and
MouseMove, are triggered by the control.

Useful objects: Screen and ClipboardThe *Screen object* represents the
complete Windows environment. It allows access to all Forms and Controls. I=
t
has *2 important properties* that we need:

   - *ActiveForm* returns the name of the Form currently active.

   - *ActiveControl* returns the name of the Control that currently has *
   focus*.


In the example that follows we will use these properties to avoid having to
name the form and the control in code. This is a way of implementing
*re-usability
of code*, an important design principle - we can write code that can be
re-used in many applications without having to be re-written.

The *Clipboard object* is the system clipboard that you know from all your
other Windows applications. It is the object that temporarily stores text o=
r
graphics between applications. In the case of the Clipboard object, it has =
*3
important methods* that we will use:

   - *Clear* empties the Clipboard.

   - *SetText* puts the selected text into the Clipboard.

   - *GetText* gets the contents of the Clipboard.


ExampleFor the purposes of this example, we will use the Registration Form
from Lesson 5.
We will add a Comment TextBox to the form. This textbox will be multiline,
with a vertical scrollbar. Then, we will add items to the menu to allow us
to edit the text entered in Comments. We want to be able to Cut, Copy, Past=
e
and Delete blocks of text.

To change the Menu, we again call upon the *Menu Editor*. We add the new
functions under the Edit item. To insert a *separator bar*, just put a
single hyphen in the Caption and give it a Name, mnu_sep1, for example. The
menu should look like this:



Then we code the menu events. Note that we use the Screen properties
exclusively in this example. Even if we are working in a control which is
called txt_comments, there is nothing in the code that refers specifically
to that control. We can copy this whole section to any form in any
application and it will work without a hitch.




Top <http://www.profsr.com/vb/vbless07.htm#Start>









Graphics When working with graphics (pictures, diagrams, images) the first
thing to master in the environment is the *coordinate system.* That is the
2-dimensional grid that defines locations on the screen in terms of (x,y)
coordinates. x is the horizontal position as measured from the left edge an=
d
y is the vertical position as measured from the top. (0,0) is the upper
left-hand corner of the screen, form or other container.

By default, all VB measurements are in *twips*. A twip is 1/20 of a
printer's point (of which there are 72 per inch). Thus, there are *1440
twips in an inch, 567 in a centimeter*. The measurements refer to printed
size; because there are great variations between monitors, sizes may vary.

You can change the units of measure yourself by setting the *ScaleMode
property* for objects or controls.

   *ScaleMode * *Meaning * 0  User-defined.  1  Twips - 1440 per inch.
 2  Points
- 72 per inch.  3  Pixels - number per inch depends on monitor.  4  Charact=
ers
- character =3D 1/6 inch high and 1/12 inch wide.  5  Inches.  6
Millimeters.  7  Centimeters.


*Examples:

Me.ScaleMode =3D 5
*'sets scale to inches for this form
*pic_EmployeePic.ScaleMode =3D 3*      'sets scale to pixels for control





 Adding PicturesYou can display pictures in 3 places in your application:

   - On a form
   - In a picture box
   - In an image control



The *PictureBox* control and the *Image* control are very similar in
operation. However the PictureBox is more flexible in its methods and
properties and is the one you should use most of the time. There is little
use for the Image.
In all 3 cases you will display a picture contained in a graphics file
(.BMP, .GIF, .JPEG, .WMF, etc). The name of the file containing the picture
will be entered in the *Picture property *of the control or form.
In a form, the picture cannot be resized or moved, so it should be of the
correct size before you use it. The picture will serve as background and
other controls that you put on the form will be displayed over it.
The PictureBox's *AutoSize property* must be set to *True*, otherwise the
control's size will not change to accomodate the picture, as in the example
below.



In the above example the pictures were all added to the controls at design
time.

You can also insert or remove a picture at run time. You use the *LoadPictu=
re
function*, as in: *pic_departmentlogo =3D
LoadPicture("C:\Pictures\acctnglogo.bmp")*

Removing the picture is done with the LoadPicture function without a file
name: *pic_departmentlogo =3D LoadPicture ("" )*


Drawing controlsThere are 2 controls in the toolbox which allow you to draw
directly on the form - the *Line control* and the *Shape control*.

Both are easy to use and fairly obvious. The main properties of each that
have to be manipulated are: *BorderColor* for the color of the line or shap=
e
and *BorderStyle* to use a solid or dashed line.

In addition, the Shape control has: *Shape* for rectangle, circle, etc., *
FillColor* and *FillStyle* to determine how the shape will be filled and *
BackStyle* for transparent or opaque.




Top <http://www.profsr.com/vb/vbless07.htm#Start>



MultimediaMultimedia refers to devices other than the screen or the printer
to play sounds, watch videos or record music. This is done through the use
of the *Multimedia control*. Don't look for it in the toolbox, it's not
there. It is an additional control that you must load.

First, create anew form in Project Lesson7 and call it "multimed.frm". Then=
,
in the menu, at *Project --> Components*, find the item "*Microsoft
Multimedia Control 6.0*" and check the box next to it. Hit OK and that's it=
.
The Multimedia control should now appear in your toolbox.

If you select the multimedia control and put it down on the form, you will
have a button bar like all the ones you've seen on CD players, recorders,
etc. In the *DeviceType property* you specify what type of device this
control controls:

   *DeviceType*  *Device*  CDAudio  CD Audio player  DAT  Digital audio tap=
e
player  Overlay  Overlay  Scanner  Scanner  Vcr  Videotape player and
recorder  Videodisc  Videodisc player  Other  Other devices not specified


Example: a simple CD playerWe create a new form in Lesson7 and call it
multimed.frm. After adding the Multimedia control to the toolbox, we put a
MM control on the form. Since we will only be using the one MM control,
we'll leave its name as MMControl1. The only property we have to change at
this time is the *DeviceType*, to tell it that we are using the CD player,
so we write CDAudio in DeviceType. We add a few labels to complete the form
and we get:



Now we have to write the code to operate the CD player.

Before we start to write the code there are a few things to know about the
MM control. There is a *Track property* which contains the number of the
current track. But its most important property is called the *Command
property* and it can take on several values that, in fact, operate the
device.

   *Command value* *Meaning* Open  Opens the device  Close  Closes the
device  Eject  Ejects the CD  Play  Plays the device  Pause  Pauses the
device  Next  Goes to next track  Prev  Goes to beginning of current track.
If used within 3 seconds of most recent Prev, goes to beginning of previous
track Record  Initializes recording  Save  Saves the open device file  Seek
  Step backward or forward a track  Stop  Stops the device  Step  Step
forward through tracks


Understand that both Track and Command are run-time properties because they
are meaningless at design time. For example, to open the CD player:
*MMControl1.Command =3D "Open"*      'we assign the value "Open" to the
Command property
To pause:
*MMControl1.Command =3D "Pause"*     'we assign the value "Pause" to the
Command property

Now, as you have seen, the trick is to know with which events to associate
the code that has to be written. The first one is fairly obvious: when we
load the form, the *Form_Load event*, we will open the device. Now, one we
haven't used before. When we unload the form, we will close the device. The
reason is that, once launched, the device will keep on playing, even if the
form is closed. So, just click on the *Form_Unload event* and write the cod=
e
there. Finally, just to see that things are running smoothly, we will use
the StatusUpdate event for the MM control to display the track being played
every time the status of MMControl1 changes (change track, pause, play are
all status changes).
As you will see, once the CD starts playing, you can use the buttons in the
MM toolbar to control what it does.






You may notice that some of the buttons for the CD Player are not used
during play. If you want you can hide these buttons from the control by
using the *(Custom) property*. This will open an editor window that will
allow you to customize the MMControl.










 ------------------------------


Top <http://www.profsr.com/vb/vbless07.htm#Start>



Home <http://www.profsr.com/>               =20
Tutorials<http://www.profsr.com/home3.html>




 ------------------------------
Jiyo cricket on Yahoo! India
cricket<http://us.rd.yahoo.com/mail/in/mailcricket/*http://in.sports.yahoo.=
com/cricket/>
Yahoo! Messenger
Mobile<http://us.rd.yahoo.com/mail/in/mailmobilemessenger/*http://in.mobile=
.yahoo.com/new/messenger/>Stay
in touch with your buddies all the time.

------=_Part_10112_9058871.1140614041345
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br>---------- Forwarded message ----------<br><span class=3D"gmail_quo=
te">From: <b class=3D"gmail_sendername">vittal</b> &lt;<a href=3D"mailto:vi=
ttal...@yahoo.co.in">vittal...@yahoo.co.in</a>&gt;<br>Date: Feb 22, 2006 12=
:08 PM
<br>Subject: VB5, VB6 &amp; VB7<br>To: Vittal P &lt;<a href=3D"mailto:vitta=
l...@gmail.com">vittal...@gmail.com</a>&gt;<br><br></span>
<table width=3D"100%" border=3D"0">
<tbody>
<tr>
<td valign=3D"top"><a name=3D"109907a93af8af8f_Start"></a>
<div><a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"ht=
tp://profsr.com/" target=3D"_blank">Profsr.com</a> </div>
<div align=3D"center"><font color=3D"#400080"><img src=3D"http://www.profsr=
.com/images/vbpic4.gif" border=3D"0"><br><br></font></div></td></tr>
<tr>
<td align=3D"right"><br>
<div><a title=3D"Free Visual Basic 6 lesson" onclick=3D"return top.js.OpenE=
xtLink(window,event,this)" href=3D"http://www.profsr.com/vb/vbless04.htm" t=
arget=3D"_blank"><img height=3D"31" alt=3D"Previous page" src=3D"http://www=
.profsr.com/images/cy_l_arr.gif" width=3D"31" border=3D"0">
 Previous</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a title=3D"Visual Basic 6.0 tra=
ining" onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"htt=
p://www.profsr.com/vb/vbintro.htm#content" target=3D"_blank"><img height=3D=
"31" alt=3D"TOC" src=3D"http://www.profsr.com/images/cy_u_arr.gif" width=3D=
"31" border=3D"0">
 Contents</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a onclick=3D"return top.js.Open=
ExtLink(window,event,this)" href=3D"http://www.profsr.com/vb/vbless06.htm" =
target=3D"_blank"><img height=3D"31" alt=3D"Next page" src=3D"http://www.pr=
ofsr.com/images/cy_r_arr.gif" width=3D"31" border=3D"0">
Next</a></div><br></td></tr>
<tr>
<td>
<hr width=3D"95%">

<div>
<div align=3D"center">
<h2>LESSON 5 -- More standard controls</h2></div><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140589902890&amp;lmt=3D1129335723&amp;format=3D336x280_as&amp;=
output=3Dhtml&amp;url=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbless05.htm&amp=
;color_bg=3DFFFFFF&amp;color_text=3D000003&amp;color_link=3D003399&amp;colo=
r_url=3D000003&amp;color_border=3DFFFFFF&amp;ad_type=3Dtext_image&amp;ref=
=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=3D7=
68&amp;u_w=3D1024&amp;u_ah=3D740&amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=3D3=
30&amp;u_his=3D1&amp;u_java=3Dtrue" width=3D"1" border=3D"0">
</div><br><br>
<h3>Working with arrays</h3>
<div>Before we get to today's lesson we will cover a bit of programming the=
ory on Arrays.<br>In VB, arrays work in much the same way as they do in all=
 other languages you have studied. By definition an array is <b>an indexed =
variable
</b>, meaning it is one variable with many parts, each part being reference=
d by an index number. The index number being numeric, it can be manipulated=
 by loop statements, incremented, decremented, etc. An array can contain an=
y valid data type and, if it is of the Variant type, can even contain eleme=
nts of different types.
<br>An array is declared like any other variable, with the addition of an i=
ndex:<br><br><b>
<div align=3D"center">Dim Department(6) As String</div></b><br>will declare=
 an array of 7 elements of the String type (we assume that it will be 7 Dep=
artment names). The only problem with this declaration is that the index go=
es from 0 to 6. So, if you want the name of the sixth Department you have t=
o specify Department(5), which can be confusing at times.
<br>To work around this problem you can specify the starting index in the d=
eclaration:<br><br>
<div align=3D"center"><b>Dim Months(1 To 12) As String</b></div><br>Thus, M=
onths(1) is January and Months(12) is December.<br>You don't even have to s=
tart at 1. If your Sections are numbered 101 - 120 you can define an array:=
=20
<br><br>
<div align=3D"center"><b>Dim Sections(101 To 120) As Integer</b></div><br>&=
nbsp;</div><br>One common method of manipulating arrays is to use For...Nex=
t loops:<br><br>
<div align=3D"center"><img height=3D"308" src=3D"http://www.profsr.com/imag=
es/vb05f01.gif" width=3D"468" border=3D"0"></div><br><br>An array can also =
be assigned to a variable in code. Look at the following example and unders=
tand that that is=20
<b>not an implicit declaration</b>. The variable &quot;Week&quot; is declar=
ed as Variant. It is assigned an <b>array value</b> in code.<br><br>
<div align=3D"center"><img height=3D"112" src=3D"http://www.profsr.com/imag=
es/vb05f02.gif" width=3D"508" border=3D"0"></div><br><br>Now, when we get t=
o the next set of controls, different kinds of Lists, these notions may pro=
ve useful.
<br><br><br>
<div align=3D"center"><a onclick=3D"return top.js.OpenExtLink(window,event,=
this)" href=3D"http://www.profsr.com/vb/vbless05.htm#Start" target=3D"_blan=
k">Top</a></div><br><br><br><br><br><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140589903968&amp;lmt=3D1129335723&amp;prev_fmts=3D336x280_as&a=
mp;format=3D728x15_0ads_al&amp;output=3Dhtml&amp;url=3Dhttp%3A%2F%2Fwww.pro=
fsr.com%2Fvb%2Fvbless05.htm&amp;color_bg=3DFFFFFF&amp;color_text=3D000003&a=
mp;color_link=3D003399&amp;color_url=3D000003&amp;color_border=3DFFFFFF&amp=
;ref=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=
=3D768&amp;u_w=3D1024&amp;u_ah=3D740&amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=
=3D330&amp;u_his=3D1&amp;u_java=3Dtrue" width=3D"1" border=3D"0">
</div><br><br><br>
<h3>ListBox</h3>With the ListBox control the user can select items from a l=
ist of choices. Although the list of choices can be entered in the List pro=
perty of the control, as in the example below, this is not a very good habi=
t to get into. It is essentially &quot;hardcoding&quot; data into the progr=
am and it can cause maintenance headaches.=20
<br><br>
<div align=3D"center"><img height=3D"295" src=3D"http://www.profsr.com/imag=
es/vb05f03.gif" width=3D"416" border=3D"0"></div><br><br>The common techniq=
ue for loading a ListBox is to do it in code, with the Form_Load event. Thi=
s way, if items have to be added it is a simple matter to add a line of cod=
e.
<br><br>
<div align=3D"center"><img height=3D"204" src=3D"http://www.profsr.com/imag=
es/vb05f04.gif" width=3D"409" border=3D"0"></div><br><br>
<div align=3D"center">
<table width=3D"70%" bgcolor=3D"#ffffcc">
<colgroup>
<col>
<tbody>
<tr>
<td>It is sometimes difficult to distinguish an object's Properties and its=
 Methods. In the example above we used lst_team.AddItem. What is AddItem? I=
t is a Method. How do I know? Well, to tell them apart, think of grammar. A=
 property is a characteristic, something that the object is, a color, a siz=
e - it is like an adjective. A Method is an action, something that it does,=
 in fact, a verb. When you see=20
object.something_descriptive, it is a Property. When you see object.some_ac=
tion, it is a Method.<br>&nbsp;</td></tr></tbody></colgroup></table><br><br=
>&nbsp;</div>In the example shown, <b>AddItem is a Method </b>because it is=
 the action of adding items to the ListBox.
<br>If you wanted to remove an item from the list in code, there is a <b>Re=
moveItem Method</b> for the ListBox. lst_team.RemoveItem 2 would remove the=
 3rd team - remember that it starts at 0.<br>When the Form opens, it will l=
oad the list in Form_load before the ListBox is displayed. If there are too=
 many items for the space allocated to the ListBox, it will create a vertic=
al scroll bar.=20
<br>When the user selects one of the teams from the list, we have to have a=
 way of capturing that information in a variable. That is done with the Tex=
t property of the ListBox:=20
<div align=3D"center"><b>TeamName =3D lst_team.Text</b></div>
<h3>ComboBox</h3>The ComboBox is called that because it's a combination of =
a ListBox and a TextBox. It has the advantage over the ListBox of not takin=
g up space until it is actually used which means that it makes it easier to=
 position on the Form.
<br>But the combo has the disadvantage, sort of, that the user can enter hi=
s own information, in addition to what is in the list. This may make data v=
alidation harder because the choices are not limited. When you want to forc=
e the user to make a choice only among the specified items, use a ListBox, =
even if it is a bit more awkward. If the user is allowed to override the ch=
oices, uses a ComboBox.
<br>As in the ListBox, use the <b>Text</b> property to get the information =
input.=20
<div align=3D"center"><b>Label3.Caption =3D cbo_position.Text</b></div><br>=
<br>
<div align=3D"center"><img height=3D"387" src=3D"http://www.profsr.com/imag=
es/vb05f06.gif" width=3D"317" border=3D"0"></div><br><br>
<div align=3D"center"><img height=3D"394" src=3D"http://www.profsr.com/imag=
es/vb05f07.gif" width=3D"477" border=3D"0"></div><br><br>As you can see, it=
 is fairly simple to load the ListBox and the ComboBox during the From_Load=
 event. The only other detail to note is that the order in which the items =
appear in the Combo is not the same as the order in which the items were ad=
ded. That is intentional - it is done with the=20
<b>Sorted</b> property for the ComboBox. It can also be done for the ListBo=
x.<br><br><br>
<div align=3D"center"><a onclick=3D"return top.js.OpenExtLink(window,event,=
this)" href=3D"http://www.profsr.com/vb/vbless05.htm#Start" target=3D"_blan=
k">Top</a></div><br><br><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140589906250&amp;lmt=3D1129335723&amp;prev_fmts=3D336x280_as%2=
C728x15_0ads_al&amp;format=3D336x280_as&amp;output=3Dhtml&amp;url=3Dhttp%3A=
%2F%2Fwww.profsr.com%2Fvb%2Fvbless05.htm&amp;color_bg=3DFFFFFF&amp;color_te=
xt=3D000003&amp;color_link=3D003399&amp;color_url=3D000003&amp;color_border=
=3DFFFFFF&amp;ad_type=3Dtext_image&amp;ref=3Dhttp%3A%2F%2Fwww.profsr.com%2F=
vb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=3D768&amp;u_w=3D1024&amp;u_ah=3D740&=
amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=3D330&amp;u_his=3D1&amp;u_java=3Dtru=
e" width=3D"1" border=3D"0">
</div><br><br>
<h3>DriveListBox, DirListBox, FileListBox</h3>For this next example we need=
 to create a new form, Form2, in the current Project.<br><br><b>Specificati=
ons:</b> While in Form1, the Registration form, we need to be able to hit a=
 button which will call-up a new form, the DirList form, which will look li=
ke the example below. This form will allow us to select a type of file that=
 we want to see and then to select a file, in a directory, in a drive that =
will be specified. If the file selected is an executable, we will run the f=
ile. If it is a text file we will call-up Notepad to edit it, and if it is =
a graphics file we will call-up the image editor.
<br>In fact, this allows us to call an external program from inside a form.=
 If, for example, we wish to edit the player's picture before storing it, w=
e can open the picture file with the image editor, change it, and continue =
with the rest of the form.
<br><br>
<div align=3D"center"><img height=3D"266" src=3D"http://www.profsr.com/imag=
es/vb05f08.gif" width=3D"494" border=3D"0"></div><br><br>There are 3 new co=
ntrols on this form, plus the buttons and the ListBox. Since you almost alw=
ays have only one of each of those controls on the form, we won't bother to=
 change the names of the controls in this example - we keep them as: Drive1=
, Dir1, and File1.
<br><br>The control that shows the current drive is called a <b>DriveListBo=
x</b>. The name of the active drive is in the control's <b>Drive</b> proper=
ty. The selected drive can be changed, in code, by writing: <b>Drive1.Drive
 =3D &quot;D:&quot;</b>, for example.<br><br>
<div align=3D"center">
<table width=3D"70%" bgcolor=3D"#ffffcc">
<colgroup>
<col>
<tbody>
<tr>
<td>Don't bother looking for the .Drive property in the Properties window f=
or Drive1 - you won't find it. Same with Dir1.Path and List1.FileName. That=
's because Drive is a runtime property. That is, one that is only available=
 when the program runs. Makes sense when you think about it. You can design=
 the DriveListBox to have the size, the color and the font you want but you=
 can't tell it which drive will be active at runtime. That will have to com=
e from the system.
<br>VB is full of these details. Every control has properties that are only=
 accessible at runtime, through code. The only way to find them is to look =
in the documentation. A big Reference Manual is handy and the Help function=
 helps a lot with this, too.&nbsp;
</td></tr></tbody></colgroup></table></div><br><br>The current directory is=
 in the <b>DirectoryListBox</b>. The name is in the <b>Dir1.Path</b> proper=
ty.<br><br>The default event associated with Drive1 and Dir1 is called a=20
<b>Change</b> event. That's because nothing has to be done with those contr=
ols until they are actually changed. Remember, when the program runs they a=
re automatically loaded with the current drive and the current directory ac=
tive.
<br><br>The current file selected is in the <b>FileListBox</b>, in the File=
1.FileName property. This one is not automatically loaded because there is =
no current active file. You select a file by clicking on it, generating a=
=20
<b>Click</b> event. <br><br>Study the code and then look at the explanation=
s below. To keep the code section from getting too long, explanations have =
not been included as comments.<br><br>
<div align=3D"center"><img height=3D"447" src=3D"http://www.profsr.com/imag=
es/vb05f09.gif" width=3D"534" border=3D"0"></div><br><br>
<div align=3D"center"><img height=3D"386" src=3D"http://www.profsr.com/imag=
es/vb05f10.gif" width=3D"606" border=3D"0"></div><br><br>
<div align=3D"center"><img height=3D"292" src=3D"http://www.profsr.com/imag=
es/vb05f11.gif" width=3D"533" border=3D"0"></div><br><br>Program notes:<br>
<ul type=3D"DISC">
<li>First task in Form_Load is to load the list of file types. We only want=
 to display files that are Executable, Text or Graphics. The .EXE is select=
ed by default - ListIndex =3D0.<br><br>
<li>The FileListBox <b>Pattern</b> property creates the filter for the sele=
ction.<br><br>
<li>Whenever we change the Drive selection or the Directory selection, a <b=
>Change event</b> is generated. When the Drive changes, the Directory's pat=
h changes and when the Directory changes, the list of files changes.<br>
<br>
<li>When you click on the Start button you first have to check if a file is=
 selected. If not, issue a message. <br><br>
<li>The Right() function, which we will look at in Lesson7, checks to see i=
f the rightmost character of the filename is a \. If it is it means that th=
e file is in the root directory. If it isn't, we have to add a \ between th=
e path and the filename.
<br><br>
<li>Based on the type of file selected, we execute the <b>Shell function</b=
> which runs an executable program. vbNormalFocus is the <b>window style ar=
gument</b> that tells the program to run in a normal window.<br><br>
<li>When we click on a file type, the Pattern property for the FieList must=
 change.<br><br>
<li>A double-click on a filename does the same as hitting the Start button.=
<br><br>
<li>Remember, we called this Form from the Registration form. When we're do=
ne with this, we want to close it and go back to the calling form. The Exit=
 button does an <b>Unload</b> of the current form but, <b>it does not execu=
te an End statement
</b> because that would cause the Project to end.<br><br></li></li></li></l=
i></li></li></li></li></li></ul>This final section of code is in the Regist=
ration form. It is the code for the Viewer button which calls the DirList f=
orm.
<br><br>The only thing to do is to Load the form using its FormName (from t=
he Name property) and then to execute its <b>Show method</b>. The argument =
<b>vbModeless</b> means that the form does not get exclusive focus. The opp=
osite of vbModeless is=20
<b>vbModal</b>. A <b>modal</b> form is one which requires action from the u=
ser before it can be closed. Usually, error messages are modal - you have t=
o respond, usually by hitting the OK or Cancel button, and you can't click =
on another form to send this one to the background, and you can't close it =
with the close box. A=20
<b>modeless</b> form can be sent to the background and it can be closed at =
any time.<br><br>
<div align=3D"center"><img height=3D"171" src=3D"http://www.profsr.com/imag=
es/vb05f12.gif" width=3D"428" border=3D"0"></div><br><br><br><br><br><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140589912968&amp;lmt=3D1129335723&amp;prev_fmts=3D336x280_as%2=
C728x15_0ads_al%2C336x280_as&amp;format=3D336x280_as&amp;output=3Dhtml&amp;=
url=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbless05.htm&amp;color_bg=3DFFFFFF=
&amp;color_text=3D000003&amp;color_link=3D003399&amp;color_url=3D000003&amp=
;color_border=3DFFFFFF&amp;ad_type=3Dtext_image&amp;ref=3Dhttp%3A%2F%2Fwww.=
profsr.com%2Fvb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=3D768&amp;u_w=3D1024&am=
p;u_ah=3D740&amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=3D330&amp;u_his=3D1&amp=
;u_java=3Dtrue" width=3D"1" border=3D"0">
 </div><br><br><br>
<div align=3D"center">
<hr width=3D"90%">
<br><br><a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D=
"http://www.profsr.com/vb/vbless05.htm#Start" target=3D"_blank">Top</a><br>=
<br><br><br><a title=3D"Free Microsoft Access, Visual Basic training" oncli=
ck=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://www.prof=
sr.com/" target=3D"_blank">
Home</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; <a title=3D"Free tutorials Access, VB, SQL" onclic=
k=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://www.profs=
r.com/home3.html" target=3D"_blank">Tutorials</a> </div></div><br><br></td>=
</tr>
</tbody></table>
<table width=3D"100%" border=3D"0">
<tbody>
<tr>
<td valign=3D"top"><a name=3D"109907a93af8af8f_Start"></a>
<div><a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"ht=
tp://profsr.com/" target=3D"_blank">Profsr.com</a> </div>
<div align=3D"center"><font color=3D"#400080"><img src=3D"http://www.profsr=
.com/images/vbpic4.gif" border=3D"0"><br><br></font></div></td></tr>
<tr>
<td align=3D"right"><br>
<div><a title=3D"Free Visual Basic 6 lesson" onclick=3D"return top.js.OpenE=
xtLink(window,event,this)" href=3D"http://www.profsr.com/vb/vbless05.htm" t=
arget=3D"_blank"><img height=3D"31" alt=3D"Previous page" src=3D"http://www=
.profsr.com/images/cy_l_arr.gif" width=3D"31" border=3D"0">
 Previous</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a title=3D"Visual Basic 6.0 tra=
ining" onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"htt=
p://www.profsr.com/vb/vbintro.htm#content" target=3D"_blank"><img height=3D=
"31" alt=3D"TOC" src=3D"http://www.profsr.com/images/cy_u_arr.gif" width=3D=
"31" border=3D"0">
 Contents</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a onclick=3D"return top.js.Open=
ExtLink(window,event,this)" href=3D"http://www.profsr.com/vb/vbless07.htm" =
target=3D"_blank"><img height=3D"31" alt=3D"Next page" src=3D"http://www.pr=
ofsr.com/images/cy_r_arr.gif" width=3D"31" border=3D"0">
Next</a></div><br></td></tr>
<tr>
<td>
<hr width=3D"95%">

<div>
<div align=3D"center">
<h2>LESSON 6 -- Menu and Debug</h2></div><br><br><br><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140590016546&amp;lmt=3D1129335723&amp;format=3D336x280_as&amp;=
output=3Dhtml&amp;url=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbless06.htm&amp=
;color_bg=3DFFFFFF&amp;color_text=3D000003&amp;color_link=3D003399&amp;colo=
r_url=3D000003&amp;color_border=3DFFFFFF&amp;ad_type=3Dtext_image&amp;ref=
=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=3D7=
68&amp;u_w=3D1024&amp;u_ah=3D740&amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=3D3=
30&amp;u_his=3D1&amp;u_java=3Dtrue" width=3D"1" border=3D"0">
</div><br><br><br>
<h3>Creating a Menu</h3>
<div>No! Not a restaurant menu.<br><br>If you've worked with Windows applic=
ations before you have worked with menus. Every Windows application has one=
. The menu gives the users access to functions that are not defined as cont=
rols (editing, formatting, etc) and also repeats certain functions that are=
 coded as controls (Exit button, for example). Menus offer a variety of fun=
ctionalities to define the application: we can include sub-menus, checked i=
tems, enabled/disabled functions, toolbar icons. The VB IDE that you are us=
ing certainly displays all of those tools, as in the diagram below.
<br><br><br>
<div align=3D"center"><img height=3D"266" src=3D"http://www.profsr.com/imag=
es/vb06f01.gif" width=3D"518" border=3D"0"></div><br><br>&nbsp;</div><br><b=
r><br><br>For this lesson, we will use the Registration form we created in =
Lesson 5 and we will add a menu to it.
<br><br>The easiest way to create a menu is to do it with the Application w=
izard when creating the application. But since we're not here to do things =
the easy way, we'll have to rough-it. In this case, roughing-it is not much=
 harder. We use the=20
<b>Menu Editor</b> that can be found in the Menu bar --&gt; Tools. Using th=
e Editor is fairly obvious. We just build up the menu bar on the first leve=
l and then, we add sub-menus using the arrow keys to add an elipsis before =
the captions. Thus, &amp;File is on the menu bar and ...&amp;Open is under =
&amp;File. Items can be inserted anywhere using the Insert button.=20
<br><br>You may have noticed the use of the ampersand (&amp;) in the captio=
ns (the <b>Caption</b> is the part that will display in the menu bar, not t=
he name). That is standard Windows practice. It creates a Hot-key, meaning =
a function that can be called from the keyboard using the &lt;Alt&gt; key. =
Putting an &amp; before a letter in a caption makes that letter the hot-key=
 for the function; &lt;Alt&gt;&lt;F&gt; will call-up File, &lt;Alt&gt;&lt;E=
&gt; will call-up Edit, and so on. Just make sure that the same hot-key is =
not used for 2 functions on the same level. In the menu bar for VB above, n=
ote that &lt;Alt&gt;&lt;F&gt; is used for File but, &lt;Alt&gt;&lt;o&gt; is=
 used for Format. The hot-key for each function is the letter underlined so=
 there should'nt be any confusion.
<br><br>The other consideration when creating the menu is to give each menu=
 item a specific <b>name</b>. In this case we use the prefix mnu_ to identi=
fy menu items. These are important because they will be refered to in code =
and it should be clear that mnu_exit is the Exit function in the menu where=
as cb_exit is the Exit command button.=20
<br><br>
<div align=3D"center"><img height=3D"421" src=3D"http://www.profsr.com/imag=
es/vb06f02.gif" width=3D"455" border=3D"0"></div><br><br>You can run the ap=
plication at any time while you create the menu, just to verify that it dis=
plays correctly. Of course, if you click on a menu item, nothing happens. J=
ust like controls, menu items have to be coded to work. So, we go to the co=
de window and write the code for each of the menu items that we want to act=
ivate. Fortunately, some of it is automatic. Clicking on a menu item will a=
utomatically open lower-level items, if there are any. We just code for the=
 lowest-level item. For example, for File--&gt;Open--&gt;Viewer, there is n=
o code for File, nor for Open but, we must write the code to execute for wh=
en Viewer is clicked.=20
<br><br>For this example we will code a few simple operations to show how i=
t is done. From this it is just a question of expanding the menu to display=
 more functions.<br><br>
<div align=3D"center"><img height=3D"422" src=3D"http://www.profsr.com/imag=
es/vb06f03.gif" width=3D"524" border=3D"0"></div><br><br>When working with =
forms, there is always a certain amount of data validation that has to be d=
one. Data validation consists of making sure the data is correct before doi=
ng calculations and so on. Usually, until the data is all correct certain f=
unctions such as calling the database or going to the next form have to be =
made unavailable - we say that the function is=20
<b>disabled</b>.<br><br>To complete the example, let's say that we want to =
disable the Viewer option if the player's name has not been entered. To do =
this we add some code in the Go button. The code consists of setting the=20
<b>Enabled property to False</b> if we want to disable a control or menu it=
em; we set the property to True to enable the control again. When disabled,=
 the Caption goes gray and the code cannot be executed. In the case of View=
er, where we have both a button and a menu function, we must remember to di=
sable both.
<br><br>
<div align=3D"center"><img height=3D"208" src=3D"http://www.profsr.com/imag=
es/vb06f04.gif" width=3D"395" border=3D"0"></div><br><br><br>
<div align=3D"center"><a onclick=3D"return top.js.OpenExtLink(window,event,=
this)" href=3D"http://www.profsr.com/vb/vbless06.htm#Start" target=3D"_blan=
k">Top</a></div><br><br><br><br><br><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140590017781&amp;lmt=3D1129335723&amp;prev_fmts=3D336x280_as&a=
mp;format=3D336x280_as&amp;output=3Dhtml&amp;url=3Dhttp%3A%2F%2Fwww.profsr.=
com%2Fvb%2Fvbless06.htm&amp;color_bg=3DFFFFFF&amp;color_text=3D000003&amp;c=
olor_link=3D003399&amp;color_url=3D000003&amp;color_border=3DFFFFFF&amp;ad_=
type=3Dtext_image&amp;ref=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbintro.htm&=
amp;cc=3D2050&amp;u_h=3D768&amp;u_w=3D1024&amp;u_ah=3D740&amp;u_aw=3D1024&a=
mp;u_cd=3D32&amp;u_tz=3D330&amp;u_his=3D1&amp;u_java=3Dtrue" width=3D"1" bo=
rder=3D"0">
</div><br><br><br>
<h3>Debugging code</h3>After six lessons of this tutorial, it would be surp=
rising if you had never had a bug in the code you've been writing. By now y=
ou should have written some original code for yourself, not just the exampl=
es supplied with the lessons. Whenever you write code there is the possibil=
ity of making mistakes. Heck! even Professors make them, although very rare=
ly. It can be very frustrating to try to find an error when you don't know =
where to begin to look. But there are techniques that can help.
<br><br>
<div align=3D"center">
<table width=3D"70%" bgcolor=3D"#ffffcc">
<colgroup>
<col>
<tbody>
<tr>
<td>Do you know where the term &quot;<b>bug</b>&quot;, for a program error,=
 comes from? In case you've never heard the story before, here it is, as to=
ld by Grace Hopper, one of the pionneers of programming.<br>In the late 40'=
s even a simple computer was a big thing: 1000's of vacuum tubes and 1000's=
 of square feet of floor space. A group of programmers were working late on=
e hot summer night. To help to dissipate all the heat generated by those tu=
bes, all the windows were open. At one point the program that they were wor=
king on bombed-out. Eventually they found the problem: a moth had flown in =
and had become lodged in the wiring, creating a short-circuit. Afterwards, =
every time a program would crash the programmer would exclaim, &quot;There =
must be a bug in the machine!&quot;. To this day that has remained one of t=
he mainstays of programmers: when the program goes wrong, blame the hardwar=
e!&nbsp;
</td></tr></tbody></colgroup></table></div><br><br><br><br><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140590018984&amp;lmt=3D1129335723&amp;prev_fmts=3D336x280_as%2=
C336x280_as&amp;format=3D728x15_0ads_al&amp;output=3Dhtml&amp;url=3Dhttp%3A=
%2F%2Fwww.profsr.com%2Fvb%2Fvbless06.htm&amp;color_bg=3DFFFFFF&amp;color_te=
xt=3D000003&amp;color_link=3D003399&amp;color_url=3D000003&amp;color_border=
=3DFFFFFF&amp;ref=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbintro.htm&amp;cc=
=3D2050&amp;u_h=3D768&amp;u_w=3D1024&amp;u_ah=3D740&amp;u_aw=3D1024&amp;u_c=
d=3D32&amp;u_tz=3D330&amp;u_his=3D1&amp;u_java=3Dtrue" width=3D"1" border=
=3D"0">
</div><br><br><br>One of the first techniques to master is the use of <b>br=
eakpoints.</b> A breakpoint is a flag at a given point in code where progra=
m execution will be suspended to give you time to look at the content of va=
riables or at the status of properties. When VB hits a breakpoint when runn=
ing a program, the code window opens and an=20
<b>immediate window</b> opens at the bottom of the screen. You can look at =
variables or properties in the immediate window and then, either do <b>Star=
t</b> to resume execution or do <b>Step</b>, using <b>&lt;F8&gt;</b> to ste=
p through the execution, one statement at a time.
<br><br>Again we will use the code from Lesson 5. In the code window, click=
 the column to the left of a line of code. This will create a breakpoint in=
dicated by a red dot (you remove the breakpoint by clicking on the red dot)=
. When you run the program it will stop at the breakpoint. In the immediate=
 window, look at the content of different variables or properties. Step thr=
ough the code with &lt;F8&gt;; the active statement is indicated by the yel=
low arrow. All the logic represented by IF or LOOP or DO statements will be=
 executed according to the conditions present. If the yellow arrow jumps to=
 a line that you don't expect, find the reason why.
<br><br>
<div align=3D"left"><img height=3D"433" src=3D"http://www.profsr.com/images=
/vb06f05.gif" width=3D"439" border=3D"0"></div><br><br>Another technique to=
 learn is called <b>&quot;error trapping&quot;</b>. It consists in intercep=
ting errors that can occur at execution rather than programming mistakes, a=
lthough not providing for user errors can be considered a programming mista=
ke.
<br><br>Let's build a simple example. The user will input 2 numbers, a nume=
rator and a denominator. The program will divide the numerator by the denom=
inator and display the result. Easy so far. However, if the user inputs 0 f=
or the denominator, the program crashes because programming cannot make sen=
se of division by zero. So, we want to=20
<b>trap the error</b> and process it before it displays an error message to=
 the user. We will use the <b>On Error GoTo ... </b>statement. This tells t=
he program that if there is some kind of run-time error, go to the error-pr=
ocessing-routine named. We have to create a=20
<b>line label</b> to identify the error routine; a line label has a colon a=
t the end, like error_rtn:, in the example. At the same time, there is an <=
b>Err object</b> created and it contains, among other things, a <b>Number p=
roperty
</b> that will identify the error. For example, if Err.Number =3D 11, the e=
rror was a division by zero; Err.Number =3D 6 represents an overflow situat=
ion.<br><br>It is worth noting that line labels in code do not end processi=
ng in any way. When the logic gets to a line label it keeps on going. The p=
rogrammer has to make sure that the processing of errors in the error_rtn i=
s not done automatically every cycle (that is called &quot;falling through&=
quot; the next routine and it's a common error).
<br><br>
<div align=3D"center"><img height=3D"425" src=3D"http://www.profsr.com/imag=
es/vb06f06.gif" width=3D"500" border=3D"0"></div><br><br><br><br><br><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140590020484&amp;lmt=3D1129335723&amp;prev_fmts=3D336x280_as%2=
C336x280_as%2C728x15_0ads_al&amp;format=3D336x280_as&amp;output=3Dhtml&amp;=
url=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbless06.htm&amp;color_bg=3DFFFFFF=
&amp;color_text=3D000003&amp;color_link=3D003399&amp;color_url=3D000003&amp=
;color_border=3DFFFFFF&amp;ad_type=3Dtext_image&amp;ref=3Dhttp%3A%2F%2Fwww.=
profsr.com%2Fvb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=3D768&amp;u_w=3D1024&am=
p;u_ah=3D740&amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=3D330&amp;u_his=3D1&amp=
;u_java=3Dtrue" width=3D"1" border=3D"0">
 </div><br><br><br>
<div align=3D"center">
<hr width=3D"90%">
<br><br><a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D=
"http://www.profsr.com/vb/vbless06.htm#Start" target=3D"_blank">Top</a><br>=
<br><br><br><a title=3D"Free Microsoft Access, Visual Basic training" oncli=
ck=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://www.prof=
sr.com/" target=3D"_blank">
Home</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; <a title=3D"Free tutorials Access, VB, SQL" onclic=
k=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://www.profs=
r.com/home3.html" target=3D"_blank">Tutorials</a> </div></div><br><br>
<table width=3D"100%" border=3D"0">
<tbody>
<tr>
<td valign=3D"top"><a name=3D"109907a93af8af8f_Start"></a>
<div><a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"ht=
tp://profsr.com/" target=3D"_blank">Profsr.com</a> </div>
<div align=3D"center"><font color=3D"#400080"><img src=3D"http://www.profsr=
.com/images/vbpic4.gif" border=3D"0"><br><br></font></div></td></tr>
<tr>
<td align=3D"right"><br>
<div><a title=3D"Free Visual Basic 6 lesson" onclick=3D"return top.js.OpenE=
xtLink(window,event,this)" href=3D"http://www.profsr.com/vb/vbless06.htm" t=
arget=3D"_blank"><img height=3D"31" alt=3D"Previous page" src=3D"http://www=
.profsr.com/images/cy_l_arr.gif" width=3D"31" border=3D"0">
 Previous</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a title=3D"Visual Basic 6.0 tra=
ining" onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"htt=
p://www.profsr.com/vb/vbintro.htm#content" target=3D"_blank"><img height=3D=
"31" alt=3D"TOC" src=3D"http://www.profsr.com/images/cy_u_arr.gif" width=3D=
"31" border=3D"0">
 Contents</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a onclick=3D"return top.js.Open=
ExtLink(window,event,this)" href=3D"http://www.profsr.com/vb/vbless08.htm" =
target=3D"_blank"><img height=3D"31" alt=3D"Next page" src=3D"http://www.pr=
ofsr.com/images/cy_r_arr.gif" width=3D"31" border=3D"0">
Next</a></div><br></td></tr>
<tr>
<td>
<hr width=3D"95%">

<div>
<div align=3D"center">
<h2>LESSON 7 -- Text, Graphics and Multimedia</h2></div><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140590185125&amp;lmt=3D1129335724&amp;format=3D336x280_as&amp;=
output=3Dhtml&amp;url=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbless07.htm&amp=
;color_bg=3DFFFFFF&amp;color_text=3D000003&amp;color_link=3D003399&amp;colo=
r_url=3D000003&amp;color_border=3DFFFFFF&amp;ad_type=3Dtext_image&amp;ref=
=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=3D7=
68&amp;u_w=3D1024&amp;u_ah=3D740&amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=3D3=
30&amp;u_his=3D1&amp;u_java=3Dtrue" width=3D"1" border=3D"0">
</div><br><br>
<h3>Manipulating text</h3>
<div>Whenever you are entering data, creating files or databases, you are w=
orking with text strings. Text strings contain characters that can be copie=
d, deleted, cut and reassembled but they also have important visual charact=
eristics: size, color, weight, transparency, etc. In this lesson we will lo=
ok at different ways of manipulating those text strings.
<br><br>
<h4>String functions</h4>Here is a list of the basic functions that work wi=
th strings:<br><br>
<ul type=3D"DISC">
<li><b>Len(string)</b>: returns the length of <i>string</i>, the number of =
characters it contains.<br><br>
<li><b>Left(string, number)</b>: returns the number of characters specified=
 by <i>number</i> from the left end of <i>string</i>.<br><br>
<li><b>Right(string, number)</b>: returns the number of characters specifie=
d by <i>number</i> from the right end of <i>string</i>. <br><br>
<li><b>Mid(string, position, number)</b>: returns the number of characters =
specified by <i>number</i> starting at character number <i>position</i> fro=
m the left end of <i>string</i>.<br><br>
<li><b>InStr(string1, string2)</b>: returns the position of <i>string2</i> =
in <i>string1</i> - returns 0 if <i>string2</i> is not found in <i>string1<=
/i>.<br><br>
<li><b>LTrim(string), RTrim(string) and Trim(string)</b>: returns <i>string=
</i> with non-significant spaces removed from the left, the right or both, =
respectively.<br><br>
<li><b>LCase(string), UCase(string)</b>: returns <i>string </i>converted to=
 lower-case or upper-case, respectively.<br><br></li></li></li></li></li></=
li></li></ul><br><br>
<div align=3D"center"><img height=3D"396" src=3D"http://www.profsr.com/imag=
es/vb07f01.gif" width=3D"489" border=3D"0"></div><br><br>&nbsp;</div><br>
<h4>Formatting Numbers, Dates and Times</h4>The Label control is still the =
easiest way of displaying the result of calculations. Whatever the answer i=
s, just move it to Label5.Caption and it will appear on the form. Unfortuna=
tely, it does not always appear the way you want to see it. No problem if t=
he result is a string but, what if it is a dollar amount or a date of some =
kind. That will require some formatting of the result before displaying it.=
 We use the=20
<b>Format function</b>:=20
<div align=3D"center"><b>Label5.Caption =3D Format(result, &quot;formatting=
 characters&quot;)</b></div><br>
<h4>Numbers</h4>For example, given that: <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;<b>Dim result As Single<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;result =3D 3456.7<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;Label5.Caption =3D Format(result, &quot;00000.00&quot;)=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'displays: 03456.70<br><b=
r>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Label5.Caption =3D Format(result, &quot;#####.##&quot;) &nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'displays: 3456.7<br><br>&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;Label5.Caption =3D Format(result, &quot;##,##0.=
00&quot;) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'displays: 3,456=
.70<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Label5.Caption =
=3D Format(result, &quot;$##,##0.00&quot;) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; 'displays: $3,
456.70 </b><br><br>Here is a list of what the formatting characters mean:<b=
r><br>
<div align=3D"center">
<table width=3D"50%" border=3D"1">
<colgroup>
<col span=3D"2">
<tbody>
<tr>
<td>0&nbsp;</td>
<td>represents a digit, with non-significant leading and trailing zeros&nbs=
p;</td></tr>
<tr>
<td>#&nbsp;</td>
<td>represents a digit, without non-significant leading and trailing zeros&=
nbsp;</td></tr>
<tr>
<td>.&nbsp;</td>
<td>decimal placeholder&nbsp;</td></tr>
<tr>
<td>,&nbsp;</td>
<td>thousands separator&nbsp;</td></tr>
<tr>
<td>$ + - ( ) space&nbsp;</td>
<td>literal character; displayed as typed&nbsp;</td></tr></tbody></colgroup=
></table></div><br><br>
<blockquote>When displaying dollar amounts, it is good practice to always u=
se the 0 placeholder with the decimal so that <b>10 cents </b>does not come=
 out as <b>$.1</b> or <b>$0.1</b> Using the formatting string <b>&quot;$#0.=
00&quot;
</b> ensures that the value follows standard rules and comes out as <b>$0.1=
0</b>.<br><br></blockquote>
<div>
<h4>Dates and Times</h4>When working with dates and times, you need to know=
 that there is a function that will obtain the current date and time from t=
he system clock. The function is: <b>Now( )</b> and you can use it directly=
 as in:=20
<div align=3D"center"><b>Label5.Caption =3D Now( )</b></div><br><br>The res=
ult is the current date and time formatted according to what you specified =
in the Windows Control Panel for your system. If you want to format the res=
ult, because you don't want to see the time, for example, there are formatt=
ing characters for date and time, as there are for numbers. The main charac=
ters are:
<br><br>
<div align=3D"center">
<table width=3D"50%" border=3D"1">
<colgroup>
<col span=3D"2">
<tbody>
<tr>
<td>yy&nbsp;</td>
<td>year without the century - eg: 00&nbsp;</td></tr>
<tr>
<td>yyyy&nbsp;</td>
<td>year with century - eg: 2000&nbsp;</td></tr>
<tr>
<td>m&nbsp;</td>
<td>month number - eg: 12&nbsp;</td></tr>
<tr>
<td>mmm&nbsp;</td>
<td>short name of month - eg: dec&nbsp;</td></tr>
<tr>
<td>mmmm&nbsp;</td>
<td>long name of month - eg: december&nbsp;</td></tr>
<tr>
<td>d&nbsp;</td>
<td>day of the month, without zero - eg: 8&nbsp;</td></tr>
<tr>
<td>dd&nbsp;</td>
<td>day of the month, with zero - eg: 08&nbsp;</td></tr>
<tr>
<td>dddd&nbsp;</td>
<td>name of the day of the week - eg: Monday&nbsp;</td></tr>
<tr>
<td>h&nbsp;</td>
<td>hour, without zero - eg: 7&nbsp;</td></tr>
<tr>
<td>hh&nbsp;</td>
<td>hour, with zero - eg: 07&nbsp;</td></tr>
<tr>
<td>mm&nbsp;</td>
<td>minutes - eg: 45</td></tr>
<tr>
<td>ss&nbsp;</td>
<td>seconds - eg: 55</td></tr></tbody></colgroup></table></div><br><br>Thus=
, if Now( ) is July 8, 2000 ,=20
<div align=3D"center"><b>Label5.Caption =3D Format(Now( ), &quot;dddd, yyyy=
 mmmm dd&quot;)<br>returns: Saturday, 2000 July 08</b></div><br><br>Of cour=
se any other date can be formatted for display:=20
<div align=3D"center"><b>Label5.Caption =3D Format( DateOfBirth, &quot;yyyy=
-mm-dd&quot;)</b></div><br><br>
<h4>Named Formats</h4>In addition to the formatting string, there are sever=
al <b>named formats</b> that can be used to determine the output format. Th=
ese named formats are VB constants that you call when you need them:<br>
<br>
<table width=3D"60%" border=3D"1">
<colgroup>
<col span=3D"2">
<tbody>
<tr>
<td>General Number&nbsp;</td>
<td>Number with no thousands separator&nbsp;</td></tr>
<tr>
<td>Currency&nbsp;</td>
<td>Thousands separator, two digits to the right of decimal&nbsp;</td></tr>
<tr>
<td>Fixed&nbsp;</td>
<td>Displays at least one digit to the left and two digits to the right of =
decimal&nbsp;</td></tr>
<tr>
<td height=3D"24">Standard&nbsp;</td>
<td height=3D"24">Thousands separator, at least one digit to the left and t=
wo digits to the right of decimal &nbsp;</td></tr>
<tr>
<td>Percent&nbsp;</td>
<td>Multiplies by 100, add percent sign to the right&nbsp;</td></tr>
<tr>
<td>General Date&nbsp;</td>
<td>Display determined by Control panel settings; displays date and time&nb=
sp;</td></tr>
<tr>
<td>Long Date&nbsp;</td>
<td>Long date format specified for system&nbsp;</td></tr>
<tr>
<td>Short Date&nbsp;</td>
<td>Short date format specified for system&nbsp;</td></tr>
<tr>
<td>Long Time&nbsp;</td>
<td>Long time setting specified by system; includes hours, minutes, seconds=
&nbsp;</td></tr>
<tr>
<td>Short Time&nbsp;</td>
<td>Shows hours and minutes&nbsp;</td></tr></tbody></colgroup></table></div=
><br><br><br><br>
<div align=3D"center"><b>Dim DateHired As Date<br>DateHired =3D &quot;1995-=
10-25&quot;<br>Label5.Caption =3D Format(DateHired, &quot;Long Date&quot;)<=
br><br>returns: October 25, 1995</b></div><br><br><br><br><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140590187171&amp;lmt=3D1129335724&amp;prev_fmts=3D336x280_as&a=
mp;format=3D728x15_0ads_al&amp;output=3Dhtml&amp;url=3Dhttp%3A%2F%2Fwww.pro=
fsr.com%2Fvb%2Fvbless07.htm&amp;color_bg=3DFFFFFF&amp;color_text=3D000003&a=
mp;color_link=3D003399&amp;color_url=3D000003&amp;color_border=3DFFFFFF&amp=
;ref=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=
=3D768&amp;u_w=3D1024&amp;u_ah=3D740&amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=
=3D330&amp;u_his=3D1&amp;u_java=3Dtrue" width=3D"1" border=3D"0">
</div><br><br><br>
<h4>Manipulating blocks of text</h4>The <b>TextBox</b> and the <b>ComboBox<=
/b> controls contain several properties which will allow you to manipulate =
blocks of text, in addition to single characters. <br><br>If you have to in=
put a large quantity of text in a TextBox, for example, you do not want to =
see it all in a single line. There are 2 properties that you set that will =
make the data easier to see:=20
<ul>
<li><b>MultiLine =3D True</b> allows you to have several lines of input, al=
l separated by &lt;Enter&gt;.<br><br>
<li><b>ScrollBars =3D 2 - Vertical</b> will create scrollbars, useful to re=
ad text. </li></li></ul><br><br>
<div align=3D"center"><img height=3D"144" src=3D"http://www.profsr.com/imag=
es/vb07f03.gif" width=3D"475" border=3D"0"></div><br><br>Then there are 3 p=
roperties to work with a <b>block of selected text</b> in the control:=20
<ul>
<li><b>SelStart</b> an integer number identifying the start of selected tex=
t, the position of the first character in the block - starts at 0.<br><br>
<li><b>SelLength</b> an integer number identifying the number of characters=
 selected in the block.<br><br>
<li><b>SelText</b> a string containing the selected text. </li></li></li></=
ul><br>Note that this kind of manipulation is usually done with the mouse. =
However, you do not have to code for the mouse events. It is automatic - wh=
en you select text in a control, the appropriate events, MouseDown, MouseUp=
 and MouseMove, are triggered by the control.
<br><br>
<h4>Useful objects: Screen and Clipboard</h4>The <b>Screen object</b> repre=
sents the complete Windows environment. It allows access to all Forms and C=
ontrols. It has <b>2 important properties</b> that we need:<br>
<ul>
<li><b>ActiveForm</b> returns the name of the Form currently active. <br><b=
r>
<li><b>ActiveControl</b> returns the name of the Control that currently has=
 <b>focus</b>. </li></li></ul><br>In the example that follows we will use t=
hese properties to avoid having to name the form and the control in code. T=
his is a way of implementing=20
<b>re-usability of code</b>, an important design principle - we can write c=
ode that can be re-used in many applications without having to be re-writte=
n.<br><br>The <b>Clipboard object</b> is the system clipboard that you know=
 from all your other Windows applications. It is the object that temporaril=
y stores text or graphics between applications. In the case of the Clipboar=
d object, it has=20
<b>3 important methods</b> that we will use:<br>
<ul>
<li><b>Clear</b> empties the Clipboard.<br><br>
<li><b>SetText</b> puts the selected text into the Clipboard.<br><br>
<li><b>GetText</b> gets the contents of the Clipboard. </li></li></li></ul>=
<br>
<h4>Example</h4>For the purposes of this example, we will use the Registrat=
ion Form from Lesson 5.<br>We will add a Comment TextBox to the form. This =
textbox will be multiline, with a vertical scrollbar. Then, we will add ite=
ms to the menu to allow us to edit the text entered in Comments. We want to=
 be able to Cut, Copy, Paste and Delete blocks of text.
<br><br>To change the Menu, we again call upon the <b>Menu Editor</b>. We a=
dd the new functions under the Edit item. To insert a <b>separator bar</b>,=
 just put a single hyphen in the Caption and give it a Name, mnu_sep1, for =
example. The menu should look like this:
<br><br>
<div align=3D"center"><img height=3D"363" src=3D"http://www.profsr.com/imag=
es/vb07f04.gif" width=3D"366" border=3D"0"></div><br><br>Then we code the m=
enu events. Note that we use the Screen properties exclusively in this exam=
ple. Even if we are working in a control which is called txt_comments, ther=
e is nothing in the code that refers specifically to that control. We can c=
opy this whole section to any form in any application and it will work with=
out a hitch.
<br><br>
<div align=3D"center"><img height=3D"472" src=3D"http://www.profsr.com/imag=
es/vb07f02.gif" width=3D"497" border=3D"0"></div><br><br><br>
<div align=3D"center"><a onclick=3D"return top.js.OpenExtLink(window,event,=
this)" href=3D"http://www.profsr.com/vb/vbless07.htm#Start" target=3D"_blan=
k">Top</a></div><br><br><br><br><br><br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140590192093&amp;lmt=3D1129335724&amp;prev_fmts=3D336x280_as%2=
C728x15_0ads_al&amp;format=3D336x280_as&amp;output=3Dhtml&amp;url=3Dhttp%3A=
%2F%2Fwww.profsr.com%2Fvb%2Fvbless07.htm&amp;color_bg=3DFFFFFF&amp;color_te=
xt=3D000003&amp;color_link=3D003399&amp;color_url=3D000003&amp;color_border=
=3DFFFFFF&amp;ad_type=3Dtext_image&amp;ref=3Dhttp%3A%2F%2Fwww.profsr.com%2F=
vb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=3D768&amp;u_w=3D1024&amp;u_ah=3D740&=
amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=3D330&amp;u_his=3D1&amp;u_java=3Dtru=
e" width=3D"1" border=3D"0">
</div><br><br><br>
<h3>Graphics </h3>When working with graphics (pictures, diagrams, images) t=
he first thing to master in the environment is the <b>coordinate system.</b=
> That is the 2-dimensional grid that defines locations on the screen in te=
rms of (x,y) coordinates. x is the horizontal position as measured from the=
 left edge and y is the vertical position as measured from the top. (0,0) i=
s the upper left-hand corner of the screen, form or other container.=20
<br><br>By default, all VB measurements are in <b>twips</b>. A twip is 1/20=
 of a printer's point (of which there are 72 per inch). Thus, there are <b>=
1440 twips in an inch, 567 in a centimeter</b>. The measurements refer to p=
rinted size; because there are great variations between monitors, sizes may=
 vary.
<br><br>You can change the units of measure yourself by setting the <b>Scal=
eMode property</b> for objects or controls. <br><br>
<div align=3D"center">
<table width=3D"70%">
<colgroup>
<col span=3D"2">
<tbody>
<tr>
<td><b>ScaleMode&nbsp;</b></td>
<td><b>Meaning&nbsp;</b></td></tr>
<tr>
<td>0&nbsp;</td>
<td>User-defined.&nbsp;</td></tr>
<tr>
<td>1&nbsp;</td>
<td>Twips - 1440 per inch.&nbsp;</td></tr>
<tr>
<td>2&nbsp;</td>
<td>Points - 72 per inch.&nbsp;</td></tr>
<tr>
<td>3&nbsp;</td>
<td>Pixels - number per inch depends on monitor.&nbsp;</td></tr>
<tr>
<td>4&nbsp;</td>
<td>Characters - character =3D 1/6 inch high and 1/12 inch wide.&nbsp;</td>=
</tr>
<tr>
<td>5&nbsp;</td>
<td>Inches.&nbsp;</td></tr>
<tr>
<td>6&nbsp;</td>
<td>Millimeters.&nbsp;</td></tr>
<tr>
<td>7&nbsp;</td>
<td>Centimeters.&nbsp;</td></tr></tbody></colgroup></table></div><br><br><b=
>Examples:<br><br>
<div align=3D"center">Me.ScaleMode =3D 5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div=
></b>'sets scale to inches for this form<br><b>pic_EmployeePic.ScaleMode =
=3D 3</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'sets scale to pixels for control</=
div><br><br><br><br><br>
<div>
<h3>Adding Pictures</h3>You can display pictures in 3 places in your applic=
ation:=20
<ul type=3D"DISC">
<li>On a form=20
<li>In a picture box=20
<li>In an image control </li></li></li></ul><br><br>The <b>PictureBox</b> c=
ontrol and the <b>Image</b> control are very similar in operation. However =
the PictureBox is more flexible in its methods and properties and is the on=
e you should use most of the time. There is little use for the Image.
<br>In all 3 cases you will display a picture contained in a graphics file =
(.BMP, .GIF, .JPEG, .WMF, etc). The name of the file containing the picture=
 will be entered in the <b>Picture property </b>of the control or form.
<br>In a form, the picture cannot be resized or moved, so it should be of t=
he correct size before you use it. The picture will serve as background and=
 other controls that you put on the form will be displayed over it.<br>
The PictureBox's <b>AutoSize property</b> must be set to <b>True</b>, other=
wise the control's size will not change to accomodate the picture, as in th=
e example below.<br><br>
<div align=3D"center"><img height=3D"238" src=3D"http://www.profsr.com/imag=
es/vb07f05.gif" width=3D"366" border=3D"0"></div><br><br>In the above examp=
le the pictures were all added to the controls at design time.<br><br>You c=
an also insert or remove a picture at run time. You use the=20
<b>LoadPicture function</b>, as in:=20
<div align=3D"center"><b>pic_departmentlogo =3D LoadPicture(&quot;C:\Pictur=
es\acctnglogo.bmp&quot;)</b></div><br>Removing the picture is done with the=
 LoadPicture function without a file name:=20
<div align=3D"center"><b>pic_departmentlogo =3D LoadPicture (&quot;&quot; )=
</b></div><br><br>
<h3>Drawing controls</h3>There are 2 controls in the toolbox which allow yo=
u to draw directly on the form - the <b>Line control</b> and the <b>Shape c=
ontrol</b>.<br><br>Both are easy to use and fairly obvious. The main proper=
ties of each that have to be manipulated are:=20
<b>BorderColor</b> for the color of the line or shape and <b>BorderStyle</b=
> to use a solid or dashed line.<br><br>In addition, the Shape control has:=
 <b>Shape</b> for rectangle, circle, etc., <b>FillColor</b> and <b>FillStyl=
e
</b> to determine how the shape will be filled and <b>BackStyle</b> for tra=
nsparent or opaque.<br><br>
<div align=3D"center"><img height=3D"287" src=3D"http://www.profsr.com/imag=
es/vb07f06.gif" width=3D"412" border=3D"0"></div><br><br><br>
<div align=3D"center"><a onclick=3D"return top.js.OpenExtLink(window,event,=
this)" href=3D"http://www.profsr.com/vb/vbless07.htm#Start" target=3D"_blan=
k">Top</a></div><br><br><br>
<h3>Multimedia</h3>Multimedia refers to devices other than the screen or th=
e printer to play sounds, watch videos or record music. This is done throug=
h the use of the <b>Multimedia control</b>. Don't look for it in the toolbo=
x, it's not there. It is an additional control that you must load.=20
<br><br>First, create anew form in Project Lesson7 and call it &quot;multim=
ed.frm&quot;. Then, in the menu, at <b>Project --&gt; Components</b>, find =
the item &quot;<b>Microsoft Multimedia Control 6.0</b>&quot; and check the =
box next to it. Hit OK and that's it. The Multimedia control should now app=
ear in your toolbox.=20
<br><br>If you select the multimedia control and put it down on the form, y=
ou will have a button bar like all the ones you've seen on CD players, reco=
rders, etc. In the <b>DeviceType property</b> you specify what type of devi=
ce this control controls:
<br><br>
<div align=3D"center">
<table width=3D"70%">
<colgroup>
<col span=3D"2">
<tbody>
<tr>
<td><b>DeviceType</b>&nbsp;</td>
<td><b>Device</b>&nbsp;</td></tr>
<tr>
<td>CDAudio&nbsp;</td>
<td>CD Audio player&nbsp;</td></tr>
<tr>
<td>DAT&nbsp;</td>
<td>Digital audio tape player&nbsp;</td></tr>
<tr>
<td>Overlay&nbsp;</td>
<td>Overlay&nbsp;</td></tr>
<tr>
<td>Scanner&nbsp;</td>
<td>Scanner&nbsp;</td></tr>
<tr>
<td>Vcr&nbsp;</td>
<td>Videotape player and recorder&nbsp;</td></tr>
<tr>
<td>Videodisc&nbsp;</td>
<td>Videodisc player&nbsp;</td></tr>
<tr>
<td>Other&nbsp;</td>
<td>Other devices not specified&nbsp;</td></tr></tbody></colgroup></table><=
/div><br><br>
<h4>Example: a simple CD player</h4>We create a new form in Lesson7 and cal=
l it multimed.frm. After adding the Multimedia control to the toolbox, we p=
ut a MM control on the form. Since we will only be using the one MM control=
, we'll leave its name as MMControl1. The only property we have to change a=
t this time is the=20
<b>DeviceType</b>, to tell it that we are using the CD player, so we write =
CDAudio in DeviceType. We add a few labels to complete the form and we get:=
<br><br>
<div align=3D"center"><img height=3D"386" src=3D"http://www.profsr.com/imag=
es/vb07f07.gif" width=3D"531" border=3D"0"></div><br><br>Now we have to wri=
te the code to operate the CD player. <br><br>Before we start to write the =
code there are a few things to know about the MM control. There is a=20
<b>Track property</b> which contains the number of the current track. But i=
ts most important property is called the <b>Command property</b> and it can=
 take on several values that, in fact, operate the device.<br><br>
<div align=3D"center">
<table width=3D"70%">
<colgroup>
<col span=3D"2">
<tbody>
<tr>
<td><b>Command value</b></td>
<td><b>Meaning</b></td></tr>
<tr>
<td>Open&nbsp;</td>
<td>Opens the device&nbsp;</td></tr>
<tr>
<td>Close&nbsp;</td>
<td>Closes the device&nbsp;</td></tr>
<tr>
<td>Eject&nbsp;</td>
<td>Ejects the CD&nbsp;</td></tr>
<tr>
<td>Play&nbsp;</td>
<td>Plays the device&nbsp;</td></tr>
<tr>
<td>Pause&nbsp;</td>
<td>Pauses the device&nbsp;</td></tr>
<tr>
<td>Next&nbsp;</td>
<td>Goes to next track&nbsp;</td></tr>
<tr>
<td>Prev&nbsp;</td>
<td>Goes to beginning of current track. If used within 3 seconds of most re=
cent Prev, goes to beginning of previous track</td></tr>
<tr>
<td>Record&nbsp;</td>
<td>Initializes recording&nbsp;</td></tr>
<tr>
<td>Save&nbsp;</td>
<td>Saves the open device file&nbsp;</td></tr>
<tr>
<td>Seek &nbsp;</td>
<td>Step backward or forward a track&nbsp;</td></tr>
<tr>
<td>Stop&nbsp;</td>
<td>Stops the device&nbsp;</td></tr>
<tr>
<td>Step&nbsp;</td>
<td>Step forward through tracks&nbsp;</td></tr></tbody></colgroup></table><=
/div><br><br>Understand that both Track and Command are run-time properties=
 because they are meaningless at design time. For example, to open the CD p=
layer:
<br><b>MMControl1.Command =3D &quot;Open&quot;</b> &nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;'we assign the value &quot;Open&quot; to the Command property<br>To p=
ause:<br><b>MMControl1.Command =3D &quot;Pause&quot;</b>&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;'we assign the value &quot;Pause&quot; to the Command property
<br><br>Now, as you have seen, the trick is to know with which events to as=
sociate the code that has to be written. The first one is fairly obvious: w=
hen we load the form, the <b>Form_Load event</b>, we will open the device. =
Now, one we haven't used before. When we unload the form, we will close the=
 device. The reason is that, once launched, the device will keep on playing=
, even if the form is closed. So, just click on the=20
<b>Form_Unload event</b> and write the code there. Finally, just to see tha=
t things are running smoothly, we will use the StatusUpdate event for the M=
M control to display the track being played every time the status of MMCont=
rol1 changes (change track, pause, play are all status changes).
<br>As you will see, once the CD starts playing, you can use the buttons in=
 the MM toolbar to control what it does.<br><br>
<div align=3D"center"><img height=3D"338" src=3D"http://www.profsr.com/imag=
es/vb07f08.gif" width=3D"410" border=3D"0"></div><br><br><br>
<div align=3D"center"><img height=3D"268" src=3D"http://www.profsr.com/imag=
es/vb07f09.gif" width=3D"313" border=3D"0"></div><br><br>You may notice tha=
t some of the buttons for the CD Player are not used during play. If you wa=
nt you can hide these buttons from the control by using the=20
<b>(Custom) property</b>. This will open an editor window that will allow y=
ou to customize the MMControl.<br><br><img height=3D"359" src=3D"http://www=
.profsr.com/images/vb07f10.gif" width=3D"631" border=3D"0"><br><br><br><br>=
<br>
<br>
<div align=3D"center"><img height=3D"1" src=3D"http://pagead2.googlesyndica=
tion.com/pagead/imp.gif?event=3Dnoiframe&amp;client=3Dca-pub-90232639759559=
96&amp;dt=3D1140590202984&amp;lmt=3D1129335724&amp;prev_fmts=3D336x280_as%2=
C728x15_0ads_al%2C336x280_as&amp;format=3D336x280_as&amp;output=3Dhtml&amp;=
url=3Dhttp%3A%2F%2Fwww.profsr.com%2Fvb%2Fvbless07.htm&amp;color_bg=3DFFFFFF=
&amp;color_text=3D000003&amp;color_link=3D003399&amp;color_url=3D000003&amp=
;color_border=3DFFFFFF&amp;ad_type=3Dtext_image&amp;ref=3Dhttp%3A%2F%2Fwww.=
profsr.com%2Fvb%2Fvbintro.htm&amp;cc=3D2050&amp;u_h=3D768&amp;u_w=3D1024&am=
p;u_ah=3D740&amp;u_aw=3D1024&amp;u_cd=3D32&amp;u_tz=3D330&amp;u_his=3D1&amp=
;u_java=3Dtrue" width=3D"1" border=3D"0">
 </div><br><br><br>
<div align=3D"center">
<hr width=3D"90%">
<br><br><a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D=
"http://www.profsr.com/vb/vbless07.htm#Start" target=3D"_blank">Top</a><br>=
<br><br><br><a title=3D"Free Microsoft Access, Visual Basic training" oncli=
ck=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://www.prof=
sr.com/" target=3D"_blank">
Home</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp; <a title=3D"Free tutorials Access, VB, SQL" onclic=
k=3D"return top.js.OpenExtLink(window,event,this)" href=3D"http://www.profs=
r.com/home3.html" target=3D"_blank">Tutorials</a> </div></div><span class=
=3D"ad">
<br><br>
<div></div><br><br></span></td></tr></tbody></table></td></tr></tbody></tab=
le><span class=3D"ad">
<p>
<hr size=3D"1">
Jiyo cricket on <a onclick=3D"return top.js.OpenExtLink(window,event,this)"=
 href=3D"http://us.rd.yahoo.com/mail/in/mailcricket/*http://in.sports.yahoo=
.com/cricket/" target=3D"_blank">Yahoo! India cricket</a><br><a onclick=3D"=
return top.js.OpenExtLink(window,event,this)" href=3D"http://us.rd.yahoo.co=
m/mail/in/mailmobilemessenger/*http://in.mobile.yahoo.com/new/messenger/" t=
arget=3D"_blank">
Yahoo! Messenger Mobile</a> Stay in touch with your buddies all the time.=
=20
<p></p></p></span>

------=_Part_10112_9058871.1140614041345--


إنشاء مجموعة - مجموعات Google - صفحة Google الرئيسية - شروط الخدمة - سياسة الخصوصية
©2009 Google