English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

3 answers

functions can be defined as like the procedures.only differenceis that u have to return the value in function

eg:
function math(intn1 as integer,intn2 as integer) as integer
dim sum
sum =intn1+intn2
math=sum
end function

user defined datatype:

type employee
strlastname as string
strfirstname as string
end type

now create object of this datatype
dim strinfo as employee
strinfo.strfirstname="yourname"
strinfo.strlastname="yourname"
in this way u can create & retrieve values from the user defined data type

2006-10-02 07:47:11 · answer #1 · answered by nicky c 1 · 0 0

User-defined functions are function made by a programmer for a particular task. To declare:

Public Function AddFunction(X as Long, Y as Long) as Double
Calculate = X + Y
End Sub

Free VB source codes here: http://smartcoder.awardspace.com


KaBalweg
http://smartcoder.awardspace.com

2006-10-04 20:22:19 · answer #2 · answered by dabsani 3 · 0 0

FUNCTIONS:
Functions are instructions that return a value.
For ex:
(Place a button in form, change button name :Beep (in property window) click the button and write the following code :

Private Sub cmdBeep_Click()
Beep
End Sub

(now Run the programme ... You can hear the Beep) (but I cannot hear ..I am deaf)

USER DEFINED FUNCTIONS:

Double click a form - code editor - choose General & Declarations in drop down list. Then enter the following variables for a Customer Details

Option Explicit
Private Type Customer
name As String
address As String
telephone As String
End Type

(This type is declared in a form Module, with the keyword
Private which means it is only available to other code in the form module. If u want to use customer type in several form
Use Public (instead of Private)
If some one kiss you in Public it is a function that you will beat him. If you Kiss your lover in Public it is user defined. ok..?

2006-10-02 09:23:19 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers