Hello Guest it is May 12, 2021, 05:23:50 PM

Author Topic: Running Mach3 via VB.NET  (Read 3358 times)

0 Members and 1 Guest are viewing this topic.

Running Mach3 via VB.NET
« on: October 20, 2009, 07:23:44 AM »
Good morning :-)

After a long run of extensive searching and finding great help through the forums, I've hit a roadblock.

I'm trying to control Mach3 through VB.net and have the basic foundation.  I'm able to do basically everything I want with the Mach4 COM API, but my problem is that every time I restart my vb.net program, I get an error that says "Cannot create ActiveX control" on the line that reads: mach = GetObject(, "Mach4.Document")

Here is some simple code:

Code: [Select]
Dim mach As Mach4.IMach4
Dim scriptObject As Mach4.IMyScriptObject

mach = GetObject(, "Mach4.Document")
scriptObject = mach.GetScriptDispatch()

scriptObject.LoadFile("11 CUX56.TXT")


While (scriptObject.IsMoving() <> 0)
End While

If I close Mach3 and restart it after the error, the program runs fine.  The problem occurs when I close my vb.net program and reopen it (rebuild it, to be exact) without closing Mach3.

Am I not creating my object properly?  Is there a code to reset the control or to close the link to reopen it?  If I run the code with Mach3 closed, I get the same error.

I'm guessing it's related, but when I close Mach3 after getting the error, I get a popup box that says "Error Found  ,Art Code: 9991, Attempt Recovery?".

Any ideas?  Thank you very much in advance!
Re: Running Mach3 via VB.NET
« Reply #1 on: October 21, 2009, 12:17:14 PM »
Unless there is more detail with the create ActiveX control, I'd focus my attention on the 9991 error.  I just did a quick search, and there are a number of threads about it.
Re: Running Mach3 via VB.NET
« Reply #2 on: October 21, 2009, 12:23:27 PM »
Thanks.  It seems like no one knows the answer.  Yea, I'll check out the threads on the other error and maybe that will kill two birds with one stone.