Solved

Creating ActiveX control at run-time

Posted on 1998-08-05
6
177 Views
Last Modified: 2010-08-05
I have no experience with VB. I need to create ActiveX control at run-time. I tried to use GetObject and CreateObject passing ProgID. Object is created successfully. But then I cannot call any of its methods or set any of its properties. I even can't show it if I set Visible control window property to true. I get run-time error "Object doesn't support this method".

Below is my piece of code

Dim objChart As Object
Set objChart = GetObject("", "mschartlib.mschart")
objChart.Visible = True
0
Comment
Question by:galkin
6 Comments
 
LVL 1

Expert Comment

by:ndb
ID: 1467937
You should try to make a new object:
Dim objChart As New Object
0
 
LVL 7

Author Comment

by:galkin
ID: 1467938
I tried your solution and I get compiler error "Expected: identifier"
0
 
LVL 2

Expert Comment

by:percosolator
ID: 1467939
got the doesn't support this property or method.

why do you need to create it at run-time?  Why not use early binding?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Author Comment

by:galkin
ID: 1467940
I try to change control window properties, for instance Visible. In this case I get error that property or method is not supported bu the control. If I call really control method or set proprty I get OLE run-time error.
I do need to create ActiveX control at run-time. I guessed it is very basic simple task, in C++ I would do it in 10 seconds.
0
 

Accepted Solution

by:
chitnis earned 100 total points
ID: 1467941
Activex controls cannot be created at runtime.You have to load at least one controlmyocx(0) on the form at design time,Set its index property to 0 and then create a control array by saying
  load myocx(1)
0
 
LVL 7

Author Comment

by:galkin
ID: 1467942
Could you give me an example. I am absolutely not familiar with VB syntax.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help in WHSCRIPT 9 48
VB6 / DAO 3.6 / run time error: Couldn't find installable ISAM 7 79
How to set the sa password in a vb6 code for sql connection 9 38
vbModal 12 38
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now