Solved

Calling object methods without direct

Posted on 1999-01-18
2
129 Views
Last Modified: 2010-05-03
This is a tough one.
I need to call methods in an ActiveX control BUT I can't use the standard object.method to call it. I will only know it's name at run-time.

I need (I know it doesn't exist in plain VB) something like object.methods["methodname"](var1, var2). I could live without any vars.

I also know this can be implemented using the IDispatch interface methods like GetIdsOfNames...

I'm looking for something generic which can take an object and analyze it's properties and methods. I could do it with Delphi or C++, but I need to do it in VB or use something ready.

Thanks.
0
Comment
Question by:ssite
2 Comments
 
LVL 3

Accepted Solution

by:
cognition earned 200 total points
ID: 1469253
In VB6 you have the callbyname function.

CallByName(object, procedurename, calltype,[arguments()])

Combined with late binding [Set myob = CreateObject("Excel.Sheet")], you may be able to do what you want.

0
 
LVL 1

Author Comment

by:ssite
ID: 1469254
EXCELLENT COGNITION. Send me an e-mail to ssite@netvision.net.il for a little chat :-)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question