انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة

Visual Basic Functions

Share |
الكلية كلية تكنولوجيا المعلومات     القسم قسم شبكات المعلومات     المرحلة 1
أستاذ المادة انوار جعفر موسى جعفر       22/01/2013 10:00:49
Visual Basic Functions: Visual Basic offers a rich assortment of built-in functions. The numeric and
string variables are the most common used variables in programming. Therefore Visual Basic provides
the user with many functions to be used with a variable to perform certain operations or type
conversion. Detailed description of the function in general will be discussed in the following functions
section. The most common functions
Function Description
Numerical Function
X=RND
Create random number value between 0 and 1
Y=AB S(X)
Absolute ofX. IXI
Y=SQRex)
Square root of X ,
..jX
Y=SGNex)
-(-lor 0 or 1) for (XO)
Y=EXPex)
Y=LOG(X)
Natural logarithms. In X
Y=LOGex) / LOG(10)
10gX
Y=sin eX)
Trigonometric functions
Y=cos eX)
Y=tan (X)

Visual Basic Functions: Visual Basic offers a rich assortment of built-in functions. The numeric and
string variables are the most common used variables in programming. Therefore Visual Basic provides
the user with many functions to be used with a variable to perform certain operations or type
conversion. Detailed description of the function in general will be discussed in the following functions
section. The most common functions
eX
Y=ATNex)
Is arc= tan-leX) (Where X angle in radian).
Y=INTex)
Integer of X
Y=FIX(X) Take the integer part
Function of String Variable
Y=Len(x) Number of characters of Variable
Y=LCase (x) Change (0 small letters
Y=UCase (x) Change to capital letters
Y=Left (X.L) Take L character from left
Y=Right (X.L) Take L character from right
Y=Mid rxsr»
Take only characters between Sand R
for (numeric or string) variable X are stated in the following table.

3.11 Converting Data Tvpes: Visual Basic provides several conversion functions can used to
convert values into a specific data type. The following table describes the convert function.
Function Descrtptton
CDbl
The function CDbl converts, integer, long integer. and single- precision numbers to
double-precision numbers. If x is any number. then the value of CDbl(x) is the doubleprecision
number determined by x.
CInt The function CInt
converts
long
integer, single-precision,
and double precision
numbers to integer numbers. If x is any number. the value of CInt(x) is the (possibly
rounded) integer constant that x determines,
CLog
The function Cl.ng converts integer. single precision and double-precision numbers to
long integer numbers,
Ifx is any number. the value of CLng(x) is the (possibly
rounded) long integer that x determines.
CSog
The function CSng converts integer. long integer. and double-precision numbers to
single-precision numbers. If x is any number. the value of CSng(x) is the singleprecision
number that x determines.
cso The function CStI converts integer. long integer. single-precision. double-precision,
and variant numbers to strings. If x is any number. the value of CStJ (x) is the string
determined by x. unlike the Str function. CStr does not place a space in front of
positive numbers. [valiant]
Stl The Str function converts numbers to strings. The value of the function Str(n) is the
string consisting of the number n in rhe form normally displayed by a print statement.
Val
The Val function is used to convert string to double-precision numbers.
Note: The following function values for different X are given for comparison.
X=
10,999 -10.999 10.123 -10.123
FIX(X)
10 -10 10 -10
ThT(A ) 10 -11 10 -11
CINT(X)
11 -11 10 -10
Examples:
A=Lcase ("My Name Is") A= my name is
A=Ucase ("My Name Is")
A=MY NAME IS
A=" My Name Is": B=Lefi (A,7)
B=MyName
C=Right(A,7) C=Name Is
D= Mid (A,3,5)
E=Mid(A,3)

D=Name
E=Name Is

المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
download lecture file topic