473,786 Members | 2,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to List items in a resource file

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.Resource s.ResourceManag er("TutorPro.re sHighlights",
Me.GetType.Asse mbly)
SelectedAsset.I mage = CType(objRM.Get Object("Mountai n"), 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.....!!!! !

Nov 21 '05 #1
2 6642

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.Resource s.ResourceManag er("TutorPro.re sHighlights",
Me.GetType.Asse mbly)
SelectedAsset.I mage = CType(objRM.Get Object("Mountai n"), 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

Nov 21 '05 #2
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.Resource s.ResourceManag er("TutorPro.re sHighlights",
Me.GetType.Asse mbly)
Dim objResSet As ResourceSet =
objRM.GetResour ceSet(System.Gl obalization.Cul tureInfo.Invari antCulture,
True, False)
Dim objEn As IDictionaryEnum erator =
objResSet.GetEn umerator()
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

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1501
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 new items into the file. Could any people help achieve my simple objective? Any info will be appreciated, thanks a lot! --------------------------------
0
2983
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 numbers in sequential order (1-55 when ran against iexplore.exe). When I open up iexplore.exe in Visual Studio, I see 23 icons. Each icon has 1 or more sizes of the icon...I'm assuming that there are, in fact, 55 icon resources in iexplore.exe,...
3
8546
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 and merges them. Please find these two files here: http://kristonvizi.hu/L.txt http://kristonvizi.hu/GC.txt
6
4948
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? I would prefer to avoid using the Win API but will do so if that's the only way available. This is for a language-translation (of an existing program) where I wish to change (English to Spanish initially) the Descriptions for all the menu...
1
1643
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 = window.open("windowpage.html","newWin","width=100,height=100") 2) Once the window is open I want to pull a specific item from a list of items (array) and populate the open window with only that item. The
3
2372
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 error'. Same with; For Each ctl In Me!BatchInvoicesList.ItemsSelected
2
9959
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;
6
4930
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: C:\ExcelData\JulyFile1.xls SheetName: Sheet1-07032007 RowCount: 325 ColumnCount: 15 SheetName: Sheet2-07102007 RowCount: 450 ColumnCount: 25 SheetName: Sheet3-07172007 RowCount: 625 ColumnCount: 45 (I have 7 other Excel files with similar attributes)
5
4987
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 like Text = "File"; to call my translating routine
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10360
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.