<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>[CONNECT Update 16] GetStringFromMstnResource</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/234064/connect-update-16-getstringfrommstnresource</link><description>I notice that the .NET Session class has member GetStringFromMstnResource . It looks like that function gets a string from a message list stored in a .rsc file, which is what we&amp;#39;ve done for MDL and C++ apps for donkey&amp;#39;s years. 
 In a .NET AddIn , how</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [CONNECT Update 16] GetStringFromMstnResource</title><link>https://communities.bentley.com/thread/726668?ContentTypeID=1</link><pubDate>Tue, 16 Aug 2022 05:56:50 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:5de93b39-32c8-4403-bbf1-54377486318d</guid><dc:creator>Jon Summers</dc:creator><description>[quote userid="2163" url="~/products/programming/microstation_programming/f/microstation-programming---forum/234064/connect-update-16-getstringfrommstnresource/726603"]Where you would want to call GetStringFromMstnResource from a managed code .NET application for the ability to obtain a .NET String instance populated from an existing native code MDL message/string resource (primarily .rsc files, or .ma, etc.) [/quote]
&lt;p&gt;OK, so it&amp;#39;s not the intention to somehow bundle a &lt;code&gt;.rsc&lt;/code&gt; file with a .NET &lt;em&gt;AddIn&lt;/em&gt;?&lt;/p&gt;
&lt;p&gt;If I want to use an existing &lt;code&gt;.rsc&lt;/code&gt; or &lt;code&gt;.ma&lt;/code&gt; file from .NET, how do I go about opening that file so that &lt;code&gt;GetStringFromMstnResource&lt;/code&gt; can read it?&amp;nbsp; Besides opening the file, some other part of the API must register the message list IDs to that a call to &lt;code&gt;GetStringFromMstnResource&lt;/code&gt; can resolve the &lt;em&gt;message ID&lt;/em&gt; and the &lt;em&gt;message list ID&lt;/em&gt;.&amp;nbsp; You mention the &lt;code&gt;MstnMessageListNumber&lt;/code&gt;,&amp;nbsp; but MicroStationAPI help doesn&amp;#39;t go any further than to acknowledge its existence.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [CONNECT Update 16] GetStringFromMstnResource</title><link>https://communities.bentley.com/thread/726603?ContentTypeID=1</link><pubDate>Mon, 15 Aug 2022 20:45:40 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:44d14b66-2c23-47ff-9e78-5bd5e7535756</guid><dc:creator>Robert Hook</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="/members/de0601d9_2d00_ca2e_2d00_4005_2d00_a7b3_2d00_982abaee9aeb"&gt;Jon Summers&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Its primarily there for interoperability between .NET managed and native code MDL applications.&lt;/p&gt;
&lt;p&gt;Where you would want to call GetStringFromMstnResource from a managed code .NET application for the ability to obtain a .NET String instance populated from an existing (localized) native code MDL message/string resource (primarily .rsc files, or .ma, etc.) w/o need to duplicate those resource strings multiple times using different conventions for each target language and every native and managed code application instance created.&lt;/p&gt;
&lt;p&gt;The first parameter is the MessageList/StringList ID and the second parameter is the Resource ID (index) of the message string you wish to access; similar to this example:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;String levelOutput = Session.GetStringFromMstnResource (MstnMessageListNumber.Messages2, 911);
...
sOutput = String.Format (&amp;quot;({0}) {1}&amp;quot;, styleNo.ToString(), levelOutput);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;br /&gt;Bob&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>