473,651 Members | 3,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embedded Resources and ResourceManager

I have a .resx (xml) file that contains resources. I am trying to follow the
example in MSDN for creating the resource Manager as follows:

Dim myAssembly As System.Reflecti on.Assembly
myAssembly = Me.GetType.Asse mbly

Dim myManager As New _
System.Resource s.ResourceManag er("ResourceNam espace.myResour ces", _
myAssembly

What does Me refer to. I have modules and Classes in my solution. Which
class is Me supposed to refer to. The resources is embedded into my solution
dll so I have no idea which ME I'm supposed to use!
--
Dennis in Houston
Nov 21 '05 #1
7 3292
Dennis,

Beside your complain, for what I am not the best person to give you an
answer, some maybe help for your problem.

I saw your solution for the network drives, nice however the wmi classes
(which do not work on W98/Me so therefore can your solution be better) will
give you a probably better result in what you try to do and I made a sample
special for this problem, however not complete for you. You are smart enough
to know how to use it in my opinion.
------------------------------
Imports System.Manageme nt
\\\
Dim searcher As New ManagementObjec tSearcher _
("SELECT * FROM Win32_LogicalDi sk")
Dim ManObjOp As ManagementObjec t
If searcher.Get.Co unt > 1 Then
For Each ManObjOp In searcher.Get
Dim win32 As String = "Win32_LogicalD isk='" &
ManObjOp("Name" ).ToString & "'"
Dim ManObjLogD As New ManagementObjec t(win32)
For Each diskProperty As PropertyData In
ManObjLogD.Prop erties
If Not diskProperty.Va lue Is Nothing Then
Console.WriteLi ne _
("{0} = {1}", diskProperty.Na me, diskProperty.Va lue)
End If
Next
Next
End If
///
(Probably you can use as well instead of LogicalDisk , NetworkConnecti on)

Than for a lot of other parts you can use
http://msdn.microsoft.com/library/de...rpathtopic.asp

In a normal treeview of course,
However that where you are searching for My Neworklocations I have not
fount, so when you find that, than please let me know.

I have as well changed a little bit your code with the scripting maybe it
interest you
(I found it interesting code)

Imports IWshRuntimeLibr ary
\\\By Dennis of Houston (changed a little bit by Cor Ligthert)
Dim o As IWshNetwork2 = _
CType(CreateObj ect("WScript.Ne twork"), IWshNetwork2)
Dim odrives As WshCollection = CType(o.EnumNet workDrives, WshCollection)
Dim Drives(CInt(odr ives.Count / 2) - 1) As String
If odrives.Count > 0 Then
For i As Integer = 0 To odrives.Count - 1 Step 2
Drives(i) = odrives.Item(i + 0).ToString.ToL ower
Next
end if
///

I hope this helps?

Cor

Nov 21 '05 #2
"Dennis" <De****@discuss ions.microsoft. com> schrieb:
I have a .resx (xml) file that contains resources. I am trying to follow
the
example in MSDN for creating the resource Manager as follows:

Dim myAssembly As System.Reflecti on.Assembly
myAssembly = Me.GetType.Asse mbly

Dim myManager As New _
System.Resource s.ResourceManag er("ResourceNam espace.myResour ces", _
myAssembly

What does Me refer to. I have modules and Classes in my solution. Which
class is Me supposed to refer to. The resources is embedded into my
solution
dll so I have no idea which ME I'm supposed to use!


Me refers to the instance of the class containing the code that is currently
being executed.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3
Dennis,

Was the wrong thread. I pasted it as well now in the right one.

Cor
Nov 21 '05 #4
Dennis,

Me refers to all referenced objects in this class.

\\\
Public Class Whatever
Private MyString as String
Private MySub
me.MyString = "It would have better named mine or my in my opinion"
End Sut
End Class
////
Nov 21 '05 #5
The problem is that I have a resource file (xml) that is embeded in the
Application. Within the application, I use the resource file to set up a
resourcemanager in a code module (not class). I'm trying to figure out how
to instantiate the resourcemanager from the code module when the resource
file is embedded in the application file.

"Cor Ligthert" wrote:
Dennis,

Me refers to all referenced objects in this class.

\\\
Public Class Whatever
Private MyString as String
Private MySub
me.MyString = "It would have better named mine or my in my opinion"
End Sut
End Class
////

Nov 21 '05 #6

Dennis,

There is a sample in C# in your program files what makes to edit resx files
program. That it is not in VBNet tells maybe as well something about this.

http://msdn.microsoft.com/library/de...rWinresexe.asp

Just my thought,

Cor
Nov 21 '05 #7
Dennis,

Since you can't use Me in anything that is marked as Shared (ie,
everything in a module), you will have to use something like this:

Dim t as Type
t = GetType(YourMod ule)

t now contains the System.Type for your module, and you can use
t.Assembly to get the containing assembly for your module:

Dim myManager as New
System.Resource s.ResourceManag er("ResourceNam espace.myResour ces",
t.Assembly)

Hope that helps you.
Regards,
-Adam.

Dennis wrote:
The problem is that I have a resource file (xml) that is embeded in the
Application. Within the application, I use the resource file to set up a
resourcemanager in a code module (not class). I'm trying to figure out how
to instantiate the resourcemanager from the code module when the resource
file is embedded in the application file.

"Cor Ligthert" wrote:

Dennis,

Me refers to all referenced objects in this class.

\\\
Public Class Whatever
Private MyString as String
Private MySub
me.MyString = "It would have better named mine or my in my opinion"
End Sut
End Class
////

Nov 21 '05 #8

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

Similar topics

0
761
by: Philipp Seidel | last post by:
Hi there! I did not know, where this topic fits in, so I put it here. I have a minor problem with embedded resources, which puzzles me quite a lot. I'd be glad if anyone can help me on this: I've added a few files (images) to an assembly as embedded resources. Within the project folder these files are in a subfolder named "images".
0
847
by: StefanT | last post by:
Hi, there is any way to change some embedded resources at runtime ? I can pull resources from an assembly at runtime but there is any way to change this resources as well. Best regards, Stefan
1
1730
by: Vanessa | last post by:
Anyone know how to embed sound file to vb.net project, then play the sound file? I have searched the web for example... and download the example and when run, it works perfectly. But when i try to insert a sound file (.wav) to my project and set the Build Action to "Embedded Resources". And then I use the same code as what I saw in the example, but it gives me an error,
0
1151
by: schoenfeld1 | last post by:
If I have an executable with a gigabytes of embedded resources, will the CLR loader try to load the resources into memory or does it only load the code segments? The reason I ask is because I am using a large icon (supports all formats) in many forms in 1 executable, and this seems to result in much code bloat - does this translate to memory bloat at runtime?
5
10278
by: Bob Rock | last post by:
Hello, I'd like to be able to enumerate resources in embedded .resources files like it is possible with external .resources files using the ResourceReader class. Is there a way to do such a thing??? Bob Rock
0
1173
by: Kyle Kaitan | last post by:
Is there a managed way to both read from *and* write to embedded resources?
1
1601
by: thomson | last post by:
Hi all, I have added a new Item in my Solution Test.sql which has got some sql scripts and i have changed the Build Action Property of the file to embedded Resources private string GetSql(string Name) {
2
2552
by: Dan | last post by:
Hi, How do I embed a picture (gif for instance) in a dll using VB.NET so that the picture can be used in a html page with the res protocol? I have tried adding pictures (as Embedded resources) to my class library and then accessing them from html with <IMG SRC="res://ResLib.dll/GIF/ResLib.testpic.gif"> The name "ResLib.testpic.gif" comes from
4
1729
by: Bob Rock | last post by:
Hello, I'd like to programmatically access keys and values of on .resources file embedded in my assembly. I've seen that the assembly class provides the GetManifestResourceStream method .... but then I don't know I to access single keys and values inside the same .resources file. I'd like to be able to do something like what is possible with the ResourceManager class but I haven't found a way to use it with embedded resources but only...
0
8277
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8465
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
8581
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
7298
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...
1
6158
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5612
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();...
0
4285
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1910
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1588
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.