Wednesday, December 19, 2007

How to shows the use these declaration statements for actual variable for following code

How to shows the use these declaration statements for actual variable for following code

Private numval As Integer

Private avgval As Integer, inptval As Variant

Static clcAverage As Single

Dim inptmsg as string

It is best to declare your variables using the Dim or other statements shown earlier, but you also can assign a type to a variable using an implicit declaration. With this type of declaration, a special character is used at the end of the variable name when the variable is first assigned a value.

How to use the variable declarations

How to use the variable declarations

Each of the following statements can be used to explicitly declare a variable’s type:

Dim varname [As vartype] [ , varname2 [As vartype2]]

Private varname [As vartype] [ ,varname2 [As vartype2]]

Static varname [As vartype ] [ , varname2 [As vartype]]

Public varname [As vartype] [ , varname2 [As vartype2]]

Dim, Private, Static, and Public are Visual Basic keyword that define how and where the variable can be used. varname and varname2 represent the names of the variables that you want to declare. As indicated in the syntax, you can specify multiple variables in the same statement, as long as you separate the variables by commas.

Vartype and vartype2 represent the type definition of the respective variables. The type definition is a keyword, which tells VB what kind of information will be stored in the variable.

How to use VB6 to create a simple division program

How to use VB6 to create a simple division program

a) The interface of the program, it’s support three type of division.

b) The source code of the division program at the command button.

inpt1 = Text1.Text

inpt2 = Text2.Text

Text3.Text = inpt1 / inpt2

Text4.Text = inpt1 \ inpt2

Text5.Text = inpt1 Mod inpt2

c) The result is like below


How to use different control used to handle different types of data

How to use different control used to handle different types of data

Control Name

Data Type

Control Property

Label

Text, Numeric, Date

Caption

TextBox

Text, Memo, Numeric, Date

Text

CheckBox

Logical, True/False

Value

PictureBox

Long Binary

Picture

Image

Long Binary

Picture