Before I start...I have some downloadable files at the website http://wap3.com
look in the Download section and some others examples in MapBasic & Code
DO is like a SUB in that it only does something
you are telling MI [via MB commands - and only those that can be used in the
MBwindow - ie, no loops, if-then, etc]
so considering you example that you perviously issued mi.DO(DIM s_table AS
String) and you have declared [not required in VB but is programming *best
practice*] "s_table" in you code then either way will work
EVAL is like a FUNCTION in that it returns a value
**NOTE it only returns a string value
How I describe Integratation and what goes on is............
Let MapInfo do what it does best -- mapping
and your code do its best -- a better user interface or high level number
crunching.
Having said the above I would DIM all variables that are going to do heavy
processing via DO("DIM x AS String") so that you avoid the overhead of
passing that data back to your code.
Only do an EVAL when the data is something the user needs to know and
manipulate such as a table name [your example]
You MUST use DO("UNDIM variable-name") or it will stay locked in MI which can
create some debugging [code crashes before UNDIM]
You can use the MapBasic Window to UNDIM them but if the list is long it is a
real pain
small example
[I write in Delphi so my VB syntax my be incorrect but you'll get the point]
create a form with a list box [ListBox1] and a button with below code in the
click event of the button
DIM x AS Integer
DIM i as integer
CONST Tab_Info_Name 1
x = INT(mi.EVAL("NumTables()"))
FOR i = 1 to x
ListBox1.Items.Add(miMap.EVAL("TableInfo(" + STR(i) + "," + Tab_Info_Name
+")" )
NEXT
On Sunday 28 May 2006 01:48, Alvin Ng wrote:
> Hello All,
>
> This question is pertaining to Integrated Mapping.
>
> I was wondering
> 1) What's the difference between mi.Do and mi.Eval and
> 2) When to use which one? Eg: i can use mi.Do("s_table = PathToTableName$(
> )") and i can use s_table = mi.Eval("PathToTableName$( )")
>
> If there's any examples/guidelines to illustrate the difference, is greatly
> appreciated. Presently, i'm using VB6 and MapInfo 7.0
>
> _________________________________________________________________
> Join the next generation of Hotmail and you could win the adventure of a
> lifetime
> http://www.imagine-msn.com/minisites/sweepstakes/mail/register.aspx
--
Trey Pattillo
Failure is not an option....
It comes standard with all Microsoft products.
_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l