Left Quote    Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln    
Right Quote
[login] | [Register]

Getting Started with VB 6.0

by: bs0d
Page: 2 of 9
(View All)

Labels, Text Boxes and Command Buttons

Label - A control that is used to display text as a caption. Labels cannot be altered by the user. They are simply used to display headings and are a result of processing, as well as other information on a form. Labels begin with a lbl prefix.

Examples of labels:
  • lblName
  • lblAddress
  • lblCity

Text Box - Control that is used to enter information onto a form. Text boxes can have focus, and are the primary means of providing input to a project in Visual Basic. Text boxes begin with the prefix of txt

Examples of Text Boxes:
  • txtSponge
  • txtBob
  • txtNum1

Command Buttons - Control that is used to activate a procedure. When a command button is clicked or activated using an access key, an event will take place (the code behind the command button is executed.) Command buttons begin with the prefix cmd

Types of Errors

  • Syntax Error - This is an error caused by a violation of the structural syntax rules defined by Visual Basic. They are compiler errors that occur when your project code is converted to machine language. VB will highlight these errors in RED.
  • Run-Time Errors - Error that occurs during the execution of the program. These types of errors will cause the program to terminate abnormally.
    Examples of run-time errors are: division by zero, or calculations with non-numeric data. VB will display a dialog box, pull up the affected code on screen, and highlight where the error occurred in YELLOW.
  • Logical Error - This is an error that allow your project to run, but will produce incorrect results. These errors are tough to find and debug, because no error message will be displayed or highlighted. You will have to dig through the code to find the error(s).
    Examples would be: Adding 3 instead of subtracting 3, or displaying the wrong information in a label.

Special Functions and Methods

VAL - A function that will convert a string to a numeric value. It will begin with the far left character of the string. If that character is a numeric digit, decimal point or sign, VAL will convert the character to a numeric value, and continue to the next character. Once a non-numeric character is found, the VAL function will stop.

PrintForm - A method that will print the current form on the printer. This is executed during run-time.

FORMAT - This is used to format a variable. Variables can be formatted as fixed numbers, currency and percents.

Syntax :


FormatCurrency - This function will take a number and format it as currency with two decimal places and a $ sign. There is only one argument, the number you want to format.

FormatNumber - This function will format a number as a decimal with a set number of decimal places. The first argument is the number you want to format. The second is the number of decimal places you want the number to have.

FormatPercent - This function will take the number, and format it as a percent by multiplying the number by 100 and adding a percent sign to the end. By default, the number will be rounded to zero decimal places unless you specify a second argument.

FormatDate and Time - This function will take a string and format it as a Date, Time or both. The first argument is the date or time to be formatted. The second argument is the format of date/time you decide to use.

1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  
Next »

No Comments for this page.

You Must be logged in or a member to comment.

Tutorial Stats

Tutorial Stats

0 Total Comments
4.16 Rating of 5 (6 Votes)


Tutorial Options

· Login to Rate This Article
· Login to Post a Comment
· Read more by this author
Digg This Article! Bookmark This Article Reddit: Bookmark This Article BlinkList: Blink This Article! YahooMyWeb BlogMarks: Add This Mark! Furl: Save This Article Spurl: Mark This Article



· Coding a Webserver
· Using Crystal Reports in VB
Your Article Here

"" Copyright © 2002-2020; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank