Problem dim'ing a custom component

TonyG

New member
Joined
Jan 19, 2010
Messages
1
Programming Experience
10+
The last time I used VB for anything serious was VB 4. I'm brand new to VB 2008. I'm trying to use it to write a program around a custom ActiveX control provided by a third party vendor, and I'm having difficulty figuring out how to dim the component.

The component is an EXE file. I added it to the project (it shows up under the WindowsApplication1 list in the solution explorer). Then I opened it by double-clicking on the name. In the Object Browser the component shows up as a container named Mach4 (I assume the books icon indicates a container). Under that is a namespace named Mach4 (again, assuming the braces icon means namespace). Under that is a class named "CMach4Doc" (assuming the multicolored boxes icon means class).

My form code looks like this:

Public Class Form1
Dim mach As Mach4.Mach4
mach = GetObject(, "Mach4.Document")
Dim scriptObject As Mach4.IMyScriptObject
scriptObject = mach.GetScriptDispatch()
End Class


I copied this from a thread on the support forum for the program I'm using. When I run it I get a type not defined error on both Dim lines. I also tried changing the line to:

Dim mach As Mach4.CMach4Doc

This doesn't match what I read in the other forum, but the Object Browser pretty clearly shows that the class name is CMach4Doc, so this seems logical. I still get the same error.

I'm sure I'm missing something stupid about including the object definitions in the project, or my syntax is slightly off or something, but I'm stuck.
 
Back
Top