Solved

VB.Net Working with My.Resources dynamically

Posted on 2010-08-24
3
711 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 200 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

734 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