Solved

Creating ActiveX control at run-time

Posted on 1998-08-05
6
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

726 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