Passing array as Sub parameter from C#

45 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 PM (2 days ago) Oct 24
to MapInfo-L
Can this callmapbasicsubroutine() return a value? 
Reply all
Reply to author
Forward
0 new messages