|
-
Sep 20th, 2006, 04:58 AM
#1
Thread Starter
Lively Member
[RESOLVED] Friend function
What is the use of friend function in VB 6.0
-
Sep 20th, 2006, 05:06 AM
#2
Re: Friend function
 Originally Posted by balajikandaswamy
What is the use of friend function in VB 6.0
I never used friend function in the vb but for vb.net you
Look Here
-
Sep 20th, 2006, 05:11 AM
#3
Re: Friend function
If you have MSDN help installed you can type friend in your project, highlight it, press F1...for this:
Modifies the definition of aprocedure in a form module orclass module to make the procedure callable from modules that are outside theclass, but part of theproject within which the class is defined. Friend procedures cannot be used in standard modules.
Syntax
[Private | Friend | Public] [Static] [Sub | Function | Property] procedurename
The required procedurename is the name of the procedure to be made visible throughout the project, but not visible to controllers of the class.
Remarks
Public procedures in a class can be called from anywhere, even by controllers of instances of the class. Declaring a procedure Private prevents controllers of the object from calling the procedure, but also prevents the procedure from being called from within the project in which the class itself is defined. Friend makes the procedure visible throughout the project, but not to a controller of an instance of the object. Friend can appear only in form modules and class modules, and can only modify procedure names, notvariables or types. Procedures in a class can access the Friend procedures of all other classes in a project. Friend procedures don't appear in thetype library of their class. A Friend procedure can't be late bound.
When placed in a class module, the following code makes the member variable dblBalance accessible to all users of the class within the project. Any user of the class can get the value; only code within the project can assign a value to that variable.
VB Code:
Private dblBalance As Double
Public Property Get Balance() As Double
Balance = dblBalance
End Property
Friend Property Let Balance(dblNewBalance As Double)
dblBalance = dblNewBalance
End Property
-
Sep 20th, 2006, 06:30 AM
#4
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|