Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB.Net Working with My.Resources dynamically

Posted on 2010-08-24
3
Medium Priority
?
725 Views
Last Modified: 2012-05-10
Hi Experts,

I'm trying to dynamically work with resource files.
I have created a resource file 'Audio' and added several mp3 files to it.

Normally I would access them via My.Resources.Audio.File1, however I would like to access them based on a combobox's text.

I tried CallByName(), but i cannot get that to work.  

Any suggestions on getting this working?
0
Comment
Question by:sgaggerj
  • 2
3 Comments
 
LVL 17

Assisted Solution

by:Zhaolai
Zhaolai earned 800 total points
ID: 33512413
       Dim o As Object
        Select Case ComboBox1.SelectedIndex
            Case 0
                o = My.Resources.Audio.File1
            Case 1
                o = My.Resources.Audio.File2
             Case 2
                o = My.Resources.Audio.File3
              ......
        End Select


0
 
LVL 1

Accepted Solution

by:
sgaggerj earned 0 total points
ID: 33513204
That's not really dynamically (or at least what i think of as "dynamic").

Here's what i came up with

Dim audio_library As My.Resources.Audio = New My.Resources.Audio
Dim audio() As Byte = audio_library.ResourceManager.GetObject(GameNamesList.Text)

It seems to work, anyone have any negatives against using that?
0
 
LVL 1

Author Closing Comment

by:sgaggerj
ID: 37126819
My solution did exactly what i needed to do as per the OP and my comment.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question