Category: GUI » VB 6.0 » Functions · 5 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns the position of the first occurrence of one string within another
Syntax:
InStr([start,]string1,string2[,compare])

Parameters Description
start Optional. Default 1 Numeric expression that sets the starting position for each search
string1 Required. String expression being searched
string2 Required. String expression searched for.
compare Optional. Numeric value indicating the kind of comparison to use when evaluating substrings

Compare Argument:

Constants Value Description
vbUseCompareOption -1 Performs a comparison using the setting of the Option Compare statement
vbBinaryCompare 0 Default. Perform a binary comparison
vbTextCompare 1 Perform a textual comparison
vbDatabaseCompare 2 Microsoft Access only. Performs a comparison based on information in your database

Return Data Type:
Long

Usage / Example Code:

Dim SearchStr as String, SearchChar as String
SearchStr = "Banyan Seed"

Statement Result / Value Remark / Note
instr(SearchStr,”b”) 0
instr(SearchStr,”B”) 1
instr(1,SearchStr,”b”,vbTextCompare) 1 is equal to instr(1,SearchStr,”b”,vbTextCompare)
instr(SearchStr,”b”,vbTextCompare) Error Run-time error ’13′: Type mismatch
instr(SearchStr,”e”) 9
instr(10,SearchStr,”e”) 10 Second occurance
instr(“”, “e”) 0
instr(4, SearchStr, “”) 4 value of start argument
instr(Null, “e”) Null
instr(SearchStr,Null) Null
xxx xxx
xxx xxx

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 11 comments
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

Description:
Returns a Double specifying the tangent of an angle

Syntax:

Tan(number)

Parameters Description
number Required. A valid numeric expression that expresses an angle in radians

Return Data Type:
Double

Usage / Example Code:

Statement Result / Value Remark / Note
tan(1) 1.5574077246549
tan(53) -0.431158196719564
tan(5.3) -1.50127339580693
tan(-1) -1.5574077246549
tan(0) 0
tan(unknown) 0 Uninitialized variable
tan(null) Error Run-time error ’94′: Invalid use of Null
tan(“string”) Error Run-time error ’13′: Type mismatch
tan(“5.3″) -1.50127339580693 Input number as string
tan(true) -1.5574077246549
tan(false) 0
tan() Error Compile error: Argument not optional

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 4 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns a Double value specifying the square root of a number

Syntax:

Sqr(number)

Parameters Description
number Required. A numeric expression

Return Data Type:
Double

Usage / Example Code:

Statement Result / Value Remark / Note
sqr(1) 1
sqr(1.5) 1.22474487139159
sqr(3) 1.73205080756888
sqr(9) 3
sqr(-1) Error Run-time error ’5′: Invalid procedure call or argument
sqr(0) 0
sqr(unknown) 0 Uninitialized variable
sqr(null) Error Run-time error ’94′: Invalid use of Null
sqr(“1.5″) 1.22474487139159
sqr(“string”) Error Run-time error ’13′: Type mismatch
sqr(true) Error Run-time error ’5′: Invalid procedure call or argument
sqr(false) 0
sqr() Compile error: Argument not optional

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 1 comment
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns a Double specifying the sine of an angle

Syntax:

Sin(number)

Parameters Description
number Required. A valid numeric expression that expresses an angle in radians

Return Data Type:
Double

Usage / Example Code:

xxx

Statement Result / Value Remark / Note
sin(1) 0.841470984807897
sin(53) 0.395925150181834
sin(5.3) -0.832267442223901
sin(-1) -0.841470984807897
sin(0) 0
sin(unknown) 0 Uninitialized variable
sin(null) Error Run-time error ’94′: Invalid use of Null
sin(True) -0.841470984807897
sin(false) 0
sin() Error Compile error: Argument not optional

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 2 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns an integer indicating the sign of a number

Syntax:

Sgn(number)

Parameters Description
number Required. A numeric expression

Return Data Type:
Variant (-1, 0 or 1)

Usage / Example Code:

Statement Result / Value Remark / Note
sgn(1) 1
sgn(123) 1
sgn(123.45) 1
sgn(0) 0
sgn(-1) -1
sgn(-123) -1
sgn(-123.45) -1
sgn(unknown) 0 Uninitialized variable
sgn(null) Error Run-time error ’94′: Invalid use of Null
sgn(“-123.45″) -1
sgn(“string”) Error Run-time error ’13′: Type mismatch
sgn(True) -1
sgn(False) 0
sgn() Error Compile error: Expected: expression

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 4 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns a number rounded to a specified number of decimal places

Syntax:

Round(expression [,numdecimalplaces])

Parameters Description
expression Required. Numeric expression being rounded
numdecimalplaces Optional. Default 0. Number indicating how many places to the right of the decimal are included in the rounding

Return Data Type:
Variant (Integer, Long, Single, Double)

Usage / Example Code:

Statement Result / Value Remark / Note
round(1.4) 1
round(1.5) 2
round(2.5) 2 Nearest even number
round(2.6) 3
round(0.0035, 3) 0.004
round(0.0045) 0.004 Nearest even digit
round(2.5, 1) 2.5
round(1234.5678, 3) 1234.568
round(123.5678) 124
round(123.4567) 123
round(-1.4) -1
round(-1.5) -2
round(-2.5) -2 Nearest even number
round(-2.6) -3
round(“123.4567″) 123 input number as string
round(unknown) 0 Uninitialized variable
round(null) Null
round(“string”) Error Run-time error ’13′: Type mismatch

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 4 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns the natural Logarithm of a number

Syntax:

Log(number)

Parameters Description
number Required. Any numeric expression

Return Data Type:
xxx

Usage / Example Code:

Statement Result / Value Remark / Note
log(1) 0
log(10) 2.30258509299405
log(-1) Error Run-time error ’5′: Invalid procedure call or argument
log(0) Error Run-time error ’5′: Invalid procedure call or argument
log(unknown) Error Run-time error ’5′: Invalid procedure call or argument
log(null) Error Run-time error ’94′: Invalid use of Null
log(“string”) Error Run-time error ’13′: Type mismatch
log(“10″) 2.30258509299405 Input number as string
log(True) Error Run-time error ’5′: Invalid procedure call or argument
log(False) Error Run-time error ’5′: Invalid procedure call or argument
log() Error Compile error: Argument not optional

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 1 comment
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns e (the base of natural logarithms) raised to a power

Syntax:

Exp(number)

Parameters Description
number Required. Any valid numeric expression

Return Data Type:
Double

Usage / Example Code:

Statement Result / Value Remark / Note
exp(1) 2.71828182845905
exp(709.782712893) 1.7976931341721E+308
exp(709.782712894) Error Run-time error ’6′: Overflow
exp(-709.782712893) 5.56268464840376E-309
exp(0) 1
exp(unknown) 1 Uninitialized variable
exp(null) Error Run-time error ’94′: Invalid use of Null
exp(“string”) Error Run-time error ’13′: Type mismatch
exp(“709.782712893″) 1.7976931341721E+308 Input number as string
exp(True) 0.367879441171442
exp(False) 1
exp() Error Compile error: Argument not optional
exp((exp(1.3) – exp(-1.3)) / 2) 1.69838243729262 Calculate hyperbolic sine

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 4 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns a Double specifying the cosine of an angle

Syntax:

Cos(number)

Parameters Description
number Required. A numeric expression that expresses an angle in radians

Return Data Type:
Double

Usage / Example Code:

Statement Result / Value Remark / Note
cos(1) 0.54030230586814
cos(53) -0.918282786212119
cos(5.3) 0.554374336179161
cos(-1) 0.54030230586814
cos(0) 1
cos(unknown) 1 Uninitialized variable
cos(null) Error Run-time error ’94′: Invalid use of Null
cos(“string”) Error Run-time error ’13′: Type mismatch
cos(“5.3″) 0.554374336179161 input number as string
cos(True) 0.54030230586814 True – Non zero
cos(False) 1 False – Zero
cos() Error Compile error: Argument not optional

Related Articles:

Print Friendly
Category: GUI » VB 6.0 » Functions · 6 comments
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Description:
Returns a Double specifying the arctangent of a number

Syntax:

Atn(number)

Parameters Description
number Required. A numeric expression

Return Data Type:
Double

Usage / Example Code:

Statement Result / Value Remark / Note
atn(1) 0.785398163397448
atn(53) 1.55193064077323
atn(5.3) 1.38430942512768
atn(-1) -0.785398163397448
atn(1)*4 3.14159265358979 Value of pi
atn(0) 0
atn(unknown) 0 Uninitialized variable
atn(null) Error Run-time error ’94′: Invalid use of Null
atn(“string”) Error Run-time error ’13′: Type mismatch
atn(“5.3″) 1.38430942512768 Number as string
atn(True) -0.785398163397448 True – Non zero
atn(False) 0 Zero
atn() Error Compile error: Argument not optional

Related Articles:

Print Friendly