Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of CallByName

Status
Not open for further replies.

TorrediPisa

Programmer
Apr 15, 2004
67
IT
Good Morning(Evening) to everyone

I am trying to understand the actual usage of the Function
CallByName.
Reading the guide, it is a function used to manipulate objects by either executing a method or setting the value of a property
Usage: CallByName(object, procedure, calltype, args)

For example,I have a Text1 in a form: if I write:
CallByName Text1, "ForeColor", VbLet, vbRed
I will obtain the same as:
text1.ForeColor = vbRed

Probably I have indicate a not much meaningful example.
Could you please explain me an example where the importance
of this function apperas more relevant.?

Thank You for Yr kind help.
Best Regards
TdP
 
One purpose is when the proceedure Name is stored in a DB Field or variable, you can either use a "Select Case" or "If" Statement to find out which method needs to be called, or use the CallByName method.
It helps when there are many different possible proceedures which could be called and the proceedure names are stored as a string.
But it does create extra overhead, which may or may not be of importance for whatever and however it is being used for.

Use a KeyWord search in this VB6 forum to see how others have found it to be useful.
 
Solved
I understand my mistake the procedure callbyname it works in this case with VbLet

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top