Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB.Net Working with My.Resources dynamically

Posted on 2010-08-24
3
Medium Priority
?
719 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

705 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