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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a component on a formless application

Status
Not open for further replies.

mchoss

Programmer
Feb 11, 2002
87
GB
VB6
Win2k

I have a proprietary component i need to interact with, and i want my application to be formless. All it does it read in a command line string when called and pass this command to another application.

To interact with this other app a component needs to be included in the project. If i put my code in a module, when i try to instantiate the object of this component i get the error 'object required'.

If i leave the code in the form (the form laod event), all is fine apart from that when the code is done, the form is still hanging around (i made it invisible).

In short: how do i include a component in an application that requires no user interface?

Thanks in advance
 
well - "when the code is done" - you could unload you form.
("unload me") and to be sure an "End" .

AS to do it without a form all together, it shouldn't be a problem - but it is difficult to say because we have no description of your component, nor when the error happens etc...
 
The component is an ocx included in the project. In general, it seems that to add a component to a project you need to add it to a form object.

Is there another way of referencing the component?

As originally described, the error occurs when i try to instatiate the object:

dim obj as object
set obj = "function of component that instantiates occurence"

I don't know much about the ocx, i have just been given it to use.

Cheers
 
Not to worry.

Moved the ocx to a reference rather than component, scrapped the form, declared a 'New' instance of the object in a module and all seems well.

It was the absence of the 'New' keyword that was preventing me being able to reference the object in the module before.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top