You can directly read or set global variables in your mapbasic program
(provided they are not global arrays). First you need to defined a Mapbasic
application object, the you can or set variables from it

Dim objMB as object

set objMB = MI.MBApplications("mbprog.mbx")

Then:

    VBVariable = objMB.MBGlobals("MbVariable").Value

or

    objMB.MBGlobals("MbVariable").Value = VBVariable

VBVariable is a variable in VB
MbVariable is the name of a global variable in mapbasic program mbprog.mbx.

----- Original Message -----
From: Brad Mathews <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 24, 2001 9:42 PM
Subject: RE: MI-L Help using Visual Basic and MI via OLE


> Alejandro,
>
> On the first issue, the variables that you define in an MB program are not
> directly accessible from VB and vice-versa. You can get a variable from MB
> by using MI.Eval() to read a global variable from MB. The only way to get
a
> VB variable into MB is to assign it to a MB variable like:
>
> MI.Do "MBVar = '" & VBVar & "' "   // for a string variable and
> MI.Do "MBVar =" & Str$(VBVar)   // for a number variable
>
> Can't help on the second issue, as I use VB to create my button routines
> instead of MB.
>
> - Brad
>
> > -----Original Message-----
> > From: MAGS-Gerencia [SMTP:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 24, 2001 12:34 PM
> > To: MapInfo-L
> > Subject: MI-L Help using Visual Basic and MI via OLE
> >
> > Hi list !
> >
> > I hope you can help me. I am in a hurry !
> > I have the next problem using VBasic and MI via OLE
> >
> > In the load form I run a MapBasic program (.mbx) which define several =
> > global variables and a custom toobar.
> >
> > The problem I find is that when I want to use the variables defined en =
> > MB program, inside the VBasic, appears an error message indicating that
=
> > the variables does not exists !
> >
> > f.e:
> > In MB program ...
> > Global gobj_rectangle as object
> >
> > In VB program
> > MI.Do "Create Rect Into Variable gobj_1 ......
> >
> > Question: Why is not possible to use the global variable defined in the
=
> > MB program ?
> >
> > (If I define the variable in VB using a MI.Do "Dim ....", all works =
> > propertly)
> >
>
> -------------------------------------------------------------------------=
> > -------
> >
> > Second problem:
> >
> > As I told you, in the MB program I also define a ButtonPad with =
> > toolbuttons to draw points and polilynes with a Calling DDE clause
> > The problem is that neither is possible to run the buttonpad option from
=
> > VB.
> >
> > but ...
> >
> > If I create the ButtonPad in VB, the application works propertly.
> >
> > Can you help me please!
> >
> > I have several drawing routines coded in MB that I need to use from VB =
> > program!
> >
> > regards
> > Alejandro
> >
> >
> > _______________________________________________________________________
> > List hosting provided by Directions Magazine | www.directionsmag.com |
> > To unsubscribe, send e-mail to [EMAIL PROTECTED] and
> > put "unsubscribe MapInfo-L" in the message body.
>
>
> _______________________________________________________________________
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, send e-mail to [EMAIL PROTECTED] and
> put "unsubscribe MapInfo-L" in the message body.



_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.

Reply via email to