Greg,

I loop through the MB applications collection because I've found it hard to
predict the correct case of all the characters in the string used to
identify the application.  Executing a loop like this in break mode will let
you see exactly whats going on too.
 
        For Each obj In objMapInfo.MBApplications
    
        If UCase(obj.Name) = "DATTOMAP.MBX" Then
        
            Set mbApp = obj
            Exit For
        End If
        Next

Richard Burkmar
ICL

-----Original Message-----
From: Toothaker, Greg [mailto:[EMAIL PROTECTED]]
Sent: 20 March 2000 23:34
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: MI VB / MB Error


I have run into a problem on a users system which is very annoying.  I have
a code which uses VB for the user interface, and MB to do the work in
MapInfo.  The error occurs while I am establishing the 'connection' between
VB and MapBasic.  My code goes as follows:

Public objMapInfo As Object
Public mbApp As Object
Public globinfo As Object

Sub Main

        Set objMapInfo = GetObject(, "MapInfo.Application")
        objMapInfo.Do "Run Application """ & App.Path & "\dattomap.mbx"""
>>>     Set mbApp = objMapInfo.MBApplications.Item("dattomap.mbx")
        Set globinfo = mbApp.MBGlobals

My error occurs on the Set mbApp statement.  I have the error trapped and
have put a timer on the error in case the mbx hasn't had time to execute.
My error trap allows about 60 seconds to pass which should be more then
enough time for the mbx to basically open and go into a wait state due to
the remote message handler in the code.  

I have noted the number of mbapplications (msgbox
objMapInfo.MBApplications.count) and it reports the correct # of mb apps.
When I attempt to note the names of the MBApplications(msgbox
objMapInfo.MBApplications.Item(1).Name ), the code fails.  

The VB error I keep getting is (-2147417851) which is basically saying 'the
server threw an exception'.  

This code works fine on 90% of my users systems.  This error is occuring on
a WinNT system where MI is local and the other mb applications run on a
server.

Any thoughts or comments would be appreciated as I am out of guesses on this
one.

Thanks,

Greg Toothaker
POWERmap Europe Product Manager
Resource Data International, Inc.
a Financial Times Energy company
[EMAIL PROTECTED]
http://www.POWERmap.com

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to