Solved

Using an OCX without a form

Posted on 1997-03-29
3
364 Views
Last Modified: 2012-08-13
I have an OCX component included in my project (my.ocx) and under the object browser, I see the class, mMyObject listed and belonging to MyLib (lib name of my.ocx).

Now, normally I can put the control on a from very easily and set it's parameters. eg. form1.mMyObject1.UserName = "fred", or form1.mMyObject1.Action = 1

I want to be able to use the ocx/class without putting the control on a form.   I want a formless (no Interface) program, so I need to be able to access the ocx routines.

How do I do that under VB5.0 Pro?
0
Comment
Question by:mjsmith032997
[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
3 Comments
 
LVL 1

Accepted Solution

by:
aktis earned 100 total points
ID: 1424814
You can use create object to reffer to the OCX control.
Here is a example with Internet explorer

      Dim Explorer As Object
      Explorer = CreateObject ("InternetExplorer.Application")
      Explorer.Navigate "http://www.microsoft.com"
      Explorer.Visible = True

E.g. with MapiSession Control you can write CreateObject("mapiSession")

       
0
 
LVL 1

Author Comment

by:mjsmith032997
ID: 1424815
Thanks aktis, that works fine with some controls, but the control I'm using cannot be used that way.   It will get an error on the CreateObject.   Error... ActiveX component can't create object.


0
 
LVL 2

Expert Comment

by:mflam
ID: 3050491
So why did you accept the answer?!
And what's the answer?
And... how do I get events this way?

Thanks, Moshe
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 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