Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I used Plausably Damp's example to build this code. The example code works but mine does not. I added the files to the resource file, and can see them when I open the Resources.resx file but no matter what I try the myassembly call returns null. I have checked for case sensitivty and ensured that the names are acurate. Not sure where I am going wrong here.

 

       private void chkPCBOne_CheckedChanged(object sender, EventArgs e)
       {
           //access the resource file where the graphic objects are embedded
           Assembly myAssem;
           myAssem = Assembly.GetExecutingAssembly();
           
           System.IO.Stream BlueLED;
           // this next line returns Null
           BlueLED = myAssem.GetManifestResourceStream("HTPlus_BON.Images.LED_Blue.gif");
           
           System.IO.Stream SeaGreenLED;
            // this next line returns Null
           SeaGreenLED = myAssem.GetManifestResourceStream("HTPlus_BON.Images.LED_Seagreen.gif");
           
           Image TempImage;

           if (chkPCBOne.Checked == true)
               TempImage = new Bitmap(SeaGreenLED);
           else
               TempImage = new Bitmap(BlueLED);

           led_One.Image = TempImage;
           CheckBoxIntegrity();
       }

 

Thanks

MT

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Posted
One thing to try - if you open the assembly with ildasm and look at the manifest there should be entries that begin

 

Must confess my ignorance here. I searched help for ildasm and found that it is also called MSIL Disassembler. I can not for the life of me figure out how to get to it to use it. I searched for the file on my hard drive and it came back with nothing. I am using .net 2005 Standard

 

MT

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

  • Administrators
Posted

If you look under the Visual Studio group on your start menu there should be a sub menu called 'Visual Studio Tools' or similar - inside there there should be a 'Visual Studio Command Prompt' - run that and then type ildasm and it should work.

 

If it isn't present then you might need to install the SDK tools either from the original VS CD / DVD or from the MS website.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

My files are not listed there?

 

If I go to myAssembly.properties.resources they are listed there as bitmap objects and they have Gets ex: get_LED_Blue.... {Long Pause while I sniff around this cool new program}

 

If I type in "Properties.Resources." it exposes my resources. Will this work as well? I am going to give it a try.

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Posted

           Image TempImage;

           if (chkPCBOne.Checked == true)
               TempImage = Properties.Resources.LED_Seagreen;
           else
               TempImage = Properties.Resources.LED_Blue;

           led_One.Image = TempImage;

 

This works. Is there a reason I should do it the other way?

 

Thanks

MT

"Beer is proof that God loves us and wants us to be happy."

-Benjamin Franklin

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...