<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using resource files in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/using-resource-files/m-p/7385485#M29613</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/786488"&gt;@SRSDS&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;This&amp;nbsp;isn't AutoCAD specific but not sure where else to post it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My app has uses a bunch of images that display in picture boxes.&lt;/P&gt;&lt;P&gt;Currently I have them in a&amp;nbsp;folder that would be distributed with the app but I'd like to import them into the project itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've worked out that I can access the imported image file using:&lt;/P&gt;&lt;P&gt;Global.MyApp.My.Resources.Resources.MyImage&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MyImage being the resource filename&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can make it a variable?&lt;/P&gt;&lt;P&gt;eg Dim MyImage as string = "Image" + "00"&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PictureBox1.Image = Global.MyApp.My.Resources.Resources.MyImage&lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The Resources class generated by the IDE should have a ResourceManager property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can call the ResourceManager's GetObject() method, passing in a string identifying the image, and cast the result to a Bitmap or whatever type the resource is.&lt;/P&gt;&lt;P&gt;The string you pass in should be the name of the property that returns the image (in your example, it would be "MyImage"):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Global.MyApp.My.Resources.Resources.GetObject("MyImage")

&lt;/PRE&gt;&lt;P&gt;You can find out a lot by&amp;nbsp;looking at the compiler-generated code that's normally hidden from you by VB.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Sep 2017 20:46:17 GMT</pubDate>
    <dc:creator>ActivistInvestor</dc:creator>
    <dc:date>2017-09-16T20:46:17Z</dc:date>
    <item>
      <title>Using resource files</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-resource-files/m-p/7385429#M29612</link>
      <description>&lt;P&gt;This&amp;nbsp;isn't AutoCAD specific but not sure where else to post it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My app has uses a bunch of images that display in picture boxes.&lt;/P&gt;
&lt;P&gt;Currently I have them in a&amp;nbsp;folder that would be distributed with the app but I'd like to import them into the project itself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've worked out that I can access the imported image file using:&lt;/P&gt;
&lt;P&gt;Global.MyApp.My.Resources.Resources.MyImage&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MyImage being the resource filename&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way I can make it a variable?&lt;/P&gt;
&lt;P&gt;eg Dim MyImage as string = "Image" + "00"&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;PictureBox1.Image = Global.MyApp.My.Resources.Resources.MyImage&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 19:44:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-resource-files/m-p/7385429#M29612</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2017-09-16T19:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using resource files</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-resource-files/m-p/7385485#M29613</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/786488"&gt;@SRSDS&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;This&amp;nbsp;isn't AutoCAD specific but not sure where else to post it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My app has uses a bunch of images that display in picture boxes.&lt;/P&gt;&lt;P&gt;Currently I have them in a&amp;nbsp;folder that would be distributed with the app but I'd like to import them into the project itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've worked out that I can access the imported image file using:&lt;/P&gt;&lt;P&gt;Global.MyApp.My.Resources.Resources.MyImage&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MyImage being the resource filename&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way I can make it a variable?&lt;/P&gt;&lt;P&gt;eg Dim MyImage as string = "Image" + "00"&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;PictureBox1.Image = Global.MyApp.My.Resources.Resources.MyImage&lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The Resources class generated by the IDE should have a ResourceManager property.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can call the ResourceManager's GetObject() method, passing in a string identifying the image, and cast the result to a Bitmap or whatever type the resource is.&lt;/P&gt;&lt;P&gt;The string you pass in should be the name of the property that returns the image (in your example, it would be "MyImage"):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Global.MyApp.My.Resources.Resources.GetObject("MyImage")

&lt;/PRE&gt;&lt;P&gt;You can find out a lot by&amp;nbsp;looking at the compiler-generated code that's normally hidden from you by VB.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Sep 2017 20:46:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-resource-files/m-p/7385485#M29613</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2017-09-16T20:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: Using resource files</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-resource-files/m-p/7385538#M29614</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4591287"&gt;@Activist_Investor&lt;/a&gt; wrote:&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;The string you pass in should be the name of the property that returns the image (in your example, it would be "MyImage"):&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Global.MyApp.My.Resources.Resources.GetObject("MyImage")

&lt;/PRE&gt;&lt;P&gt;You can find out a lot by&amp;nbsp;looking at the compiler-generated code that's normally hidden from you by VB.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Correction:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Global.MyApp.My.Resources.Resources.ResourceManager.GetObject("MyImage")&lt;/PRE&gt;</description>
      <pubDate>Sat, 16 Sep 2017 21:50:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-resource-files/m-p/7385538#M29614</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2017-09-16T21:50:15Z</dc:date>
    </item>
  </channel>
</rss>

