• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Simconnect.Text Text menu function in vb.net

Messages
2
Country
russia
Hello!

I'm trying to create a text menu in VB.net using the expression

fsx_simconnect.Text(Microsoft.FlightSimulator.SimConnect.SIMCONNECT_TEXT_TYPE.MENU, 0, Event_id.EVENT_MENU_1, "Title Menu" & vbNewLine & "Choose item:" & vbNewLine & "Item1" & vbNewLine & "Item2" & vbNewLine & "Item2")

but when I run it, I get an Exception 31 - SIMCONNECT_EXCEPTION_OUT_OF_BOUNDS.

Expression

fsx_simconnect.Text(Microsoft.FlightSimulator.SimConnect.SIMCONNECT_TEXT_TYPE.PRINT_WHITE, 0, Event_id.EVENT_MENU_1, "Message text")

works without problems.

I think, the problem in nul chars in string for SIMCONNECT_TEXT_TYPE.MENU,
but can't find a way to write the String correctly.

Tim “Beatle” Gregson in his blog https://fsandm.wordpress.com/2009/06/30/function-overloads/ mentions Managed SimConnect SDK, which, perhaps, could solve this problem. But I can't find any working links.

Can anyone help to solve this problem?

Best regards.
 
The following works for me in P3D v3.2 with P3D SDK 2.5 with C#.

Code:
        public void Text()
        {
            //SimConnectModule.Text(SIMCONNECT_TEXT_TYPE.PRINT_WHITE, 0, EVENT_ID.MENU_1, "Message text");
            // Create a polymorphic array
            string menuitems = "Title Menu\0Choose item:\0Item1\0Item2\0Item2";
            Object objv1 = Convert.ChangeType(menuitems, typeof(Object));
            SimConnectModule.Text(SIMCONNECT_TEXT_TYPE.MENU, 10.0f, EVENT_ID.MENU_1, objv1);
        }

use \0 instead of newline and GetType instead of typeof.
 
Thanks for the reply!

I was shown the correct solution on another forum.

\0 is not working on vb.net. Instead \0, in vb.net need to use CHR(0).

For the vb.net expression would be:
simconnect.Text(Microsoft.FlightSimulator.SimConnect.SIMCONNECT_TEXT_TYPE.MENU, 0, Event_id.EVENT_MENU_1, "Title Menu" & CHR(0) & "Choose item:" & CHR(0) & "Item1" & CHR(0) & "Item2" & CHR(0) & "Item2").

Convert the string to polymorphic array Object objv1 does not necessarily!
 
Back
Top