Passing array as Sub parameter from C#

70 views
Skip to first unread message

Marijan

unread,
Dec 19, 2019, 4:00:10 AM12/19/19
to MapInfo-L
Hello,

I'm trying to pass string array as parameter to mbx sub.

My C# code looks something like this:

string[] subParams = { param1, param2}
mbxApp
.CallMapBasicSubroutine("MySub", subParams);

Test .MB code:

Declare Sub MySub(subParams() as String)


Sub MySub(subParams() as String)

 
Print "Sub launched"

End Sub

I can't figure out what I'm missing, however 'MySub' doesn't run if I pass string array as parameter. If I pass only string it executes.

Peter Horsbøll Møller

unread,
Dec 21, 2019, 5:02:14 AM12/21/19
to mapi...@googlegroups.com
Can you try using the ref keyword when parsing the array:

mbxApp.CallMapBasicSubroutine("MySub", ref subParams);

Peter Horsbøll Møller
Pitney Bowes
Sent from my mobile, sorry for any typos

Den 19. dec. 2019 kl. 10.00 skrev Marijan <marija...@gmail.com>:

mbxApp.CallMapBasicSubroutine("MySub", subParams);

Marijan

unread,
Dec 22, 2019, 6:41:31 AM12/22/19
to MapInfo-L
Peter, thank you for your answer.

No, 'ref' keyword doesn't work either(VS error message: 'Argument 2 may not be passed with the 'ref keyword')

Parhat Toksun

unread,
Oct 24, 2025, 2:04:01 PMOct 24
to MapInfo-L
Can this callmapbasicsubroutine() return a value? 

Peter Horsbøll Møller

unread,
Oct 27, 2025, 6:31:12 AMOct 27
to mapi...@googlegroups.com
No, but  the EvaluateMapBasicFunction method can

Peter


Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 


From: mapi...@googlegroups.com <mapi...@googlegroups.com> on behalf of Parhat Toksun <fpa...@gmail.com>
Sent: Friday, October 24, 2025 20:04
To: MapInfo-L <mapi...@googlegroups.com>
Subject: Re: [MI-L] Passing array as Sub parameter from C#

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mapinfo-l/d7638d8f-dabf-4065-b624-64680ba5922cn%40googlegroups.com.

Parhat Toksun

unread,
Oct 27, 2025, 12:53:36 PMOct 27
to MapInfo-L
Perfect! Thank you so much. 
Reply all
Reply to author
Forward
0 new messages