Hello, After much searching, I have finally determined how to add gif
files into a resource and then get them out again in VB.NET. I have
created a resx file and have inserted a bunch of GIF files using a
resource editor that I got from CodeProject. I am then using the
following code to apply one of the graphics to an Image object:
Dim objRM As New
System.Resources.ResourceManager("TutorPro.resHigh lights",
Me.GetType.Assembly)
SelectedAsset.Image = CType(objRM.GetObject("Mountain"), Image)
Where 'resHighlights.resx' is the name of the resource file, 'TutorPro'
is my root namespace and 'Mountain' is the name I gave to the gif file
in the resource.
Here is my question, how do I get a list of all the resources in my
file? I can get individual items if I know their names but what if I
don't? What if I want to enable a user to select a gif from the
resource using a drop down combo? I would want to propogate the combo
box with the list of items but if there are 100s of gifs in the
resource, i don't want to have to hard code each 'items.add' line.
Somebody help me please.....!!!!! 2 6586
Turbot wrote: Hello, After much searching, I have finally determined how to add gif files into a resource and then get them out again in VB.NET. I have created a resx file and have inserted a bunch of GIF files using a resource editor that I got from CodeProject. I am then using the following code to apply one of the graphics to an Image object:
Dim objRM As New System.Resources.ResourceManager("TutorPro.resHigh lights", Me.GetType.Assembly) SelectedAsset.Image = CType(objRM.GetObject("Mountain"), Image)
Where 'resHighlights.resx' is the name of the resource file,
'TutorPro' is my root namespace and 'Mountain' is the name I gave to the gif
file in the resource.
Here is my question, how do I get a list of all the resources in my file? I can get individual items if I know their names but what if I don't? What if I want to enable a user to select a gif from the resource using a drop down combo? I would want to propogate the combo box with the list of items but if there are 100s of gifs in the resource, i don't want to have to hard code each 'items.add' line.
Somebody help me please.....!!!!!
The help topic ResourceReader class appears to provide sample code to
do what you want? (Got here by looking at ResourceManager members,
seeing GetResourceSet, looking at ResourceSet, clicking through
IResourceReader etc...)
--
Larry Lard
Replies to group please
Hi Larry,
Thanks for pointing me in the right direction. I have finally managed
to do what I wanted using the following code:
Dim objRM As New
System.Resources.ResourceManager("TutorPro.resHigh lights",
Me.GetType.Assembly)
Dim objResSet As ResourceSet =
objRM.GetResourceSet(System.Globalization.CultureI nfo.InvariantCulture,
True, False)
Dim objEn As IDictionaryEnumerator =
objResSet.GetEnumerator()
While objEn.MoveNext
Call Debug.WriteLine("Name = " & CType(objEn.Key,
String))
End While
I can then use the 'GetObject' method of the 'objResSet' ResourceSet
object to get the resource items.
IAN This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: msnews.microsoft.com |
last post by:
Hi,
I am trying to use below code to write .NET resource files. What I am
expecting is to append items to an exsiting file. But any time below code
just remove exsting items and just write the...
|
by: Mythran |
last post by:
I wrote some code that is supposed to enumerate through the specified file's
win32 resources and return a string-array of all icon names. When it runs,
it returns a string-array with a bunch of...
|
by: Kriston-Vizi Janos |
last post by:
Dear Mr. Kern, and Members,
Thank you very much for the fast answer, my question became
over-simplified.
My source code is appended below. It uses two text files (L.txt and
GC.txt) as input...
|
by: Bob Kochem |
last post by:
I am looking for a way via code to access all the menu itmes on a given
form. I am looking for something like the Forms or Controls collections, but
for menu items. Is there such a thing or method?...
|
by: TPK |
last post by:
Here is what I want to do with javascript.
On a page with text place a javascript link that:
1) When a user clicks the link (onClick) a new browser window opens
(the easy part) NewWindow =...
|
by: John |
last post by:
Hi
I am using the following get the items from a multiselect list;
Dim ctl As Control
For Each ctl In Me.BatchInvoicesList.ItemsSelected
Problem is that I am getting a 'Object not found...
|
by: sree reddy |
last post by:
..cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
|
by: rlntemp-gng |
last post by:
I need to extract information from some Excel files but am stuck with
part of it:
As an example, I have the following Excel File that has 3 tabbed
sheets:
FileName: ...
|
by: Andrus |
last post by:
I have database containing translations.
I'm creating VS 2005 WinForms application which should use this database to
translate menu items to user language.
I replaced lines in myform.designer.cs...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |