Results 1 to 4 of 4

Thread: Using resource files in .NET

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    68

    Using resource files in .NET

    I'm trying to use a resource file (.res) I created when working with VB6. I googled a bit, and found some code examples. But I keep getting the following error:

    Code:
    System.Resources.MissingManifestResourceException:
    
    Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly.
    Make sure "Cards01.data.resources" was correctly embedded or linked into assembly "Cards01".
    Cards01 is my project name, Data is the name of the .res file.

    The code is as following:

    Code:
    resourceManager = New ResourceManager("Cards01.data", System.Reflection.Assembly.GetExecutingAssembly)
    Code:
    picStatus.Image = resourceManager.GetObject("601.bmp")
    Basicly the program can't find the damn thing. But I tried all sorts of different syntaxes for parameters, with and without extensions. (eg. "Cards01.data.res", "data.res", "data")
    The .res file is added to my project by clicking on "add existing item..."

    Can anybody see what I'm doing wrong?

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Re: Using resource files in .NET

    In .NET res files are xml files which contain the resources so I don't believe you can use the .NET ResourceManager to read other application or previous versions resource files which were in a different format. You would need to write a custom reader for that format. If you did create the resource file in .NET then I misunderstood something.

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Using resource files in .NET

    What you may want to do is write a small vb6 program to extract the resource images in your res file. Then take those images
    and add them to your vb.net solution as Embedded Resource files.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    68

    Post Re: Using resource files in .NET

    Well that certainly didn't occur to me.
    When doubleclicking on the resource file in the solution explorer, it simply opens the 'tree' with files. So I figured it was still compatible.

    I didn't create the .res file by writing code in vb6 (if that was even possible), but simply by creating a .res file and adding all the pictures manually. Is that still possible in .NET?
    I certainly can't find the right menu option (the fact that I don't remember how I did it in vb6 doesn't help either)

    The resources file is meant to hold about 50 .bmp files, so nothing fancy.

    edit: I found out there was a tool in the SDK samples I could use. The "Resource Editor".
    Last edited by Guiseppe; Jul 3rd, 2005 at 09:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width