locked
Is there a way to create a resource file structure and reference it in a strongly-worded way? RRS feed

  • Question

  • I have a number of resources that I would like to be embedded in my program and would like some sort of way to control the mayhem by breaking it into diferent folders while keeping bugs to a minimum by utilizing a strongly-worded system.  What I have now is a folder structure that looks like:

    WPF_program

     > Properies

     > References

     v Resources

     - v folder 1

     - - - img.bmp

     - v folder 2

     - - - img.bmp

     - - - file.txt

     

    I ackowledge that I can't just throw files into the Solution Explorer and expect to reference them easier, but I am just wondering if there is a way to put resources in a folder structure and use strongly worded references, such as:

    System.Drawing.Bitmap bmp = WPF_program.Resources.folder_1.img;

    • Moved by Helen Zhou Tuesday, June 21, 2011 9:03 AM (From:Windows Forms General)
    Saturday, June 18, 2011 2:53 AM

Answers

  • Hi MOe,

    Try this in the C# forum.

    This forum is for the Windows Forms Namespace.

    The resources (embedded data) is done in Net for every program language in a different way in a piece of (designer) software you can see in the IDE.

    But has surely not only to do with System Windows Forms, 

    I've done something like you ask with reflection for VB, (created a list so in fact an extra reference dictionary) but in fact than it is still not strongly typed as reflection keeps being dangerous about typing.

    I've also investigated this some years ago for C#, but I'm forgotten if I did succeed in that.

     http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral

    It is not impossible that I will answer it there, here I've the habit to answer everything in VB and in C# because of the purpose of this forum. And what you ask is just debugging and what I wrote completely different for VB and C#. (Probably you can do it yourself also if you look at that resources.designer.Cs class.

     

     

     


    Success
    Cor



    Saturday, June 18, 2011 7:38 AM