473,468 Members | 1,332 Online
Bytes | Software Development & Data Engineering Community
Create 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.Reflection.Assembly
myAssembly = Me.GetType.Assembly

Dim myManager As New _
System.Resources.ResourceManager("ResourceNamespac e.myResources", _
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 3261
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.Management
\\\
Dim searcher As New ManagementObjectSearcher _
("SELECT * FROM Win32_LogicalDisk")
Dim ManObjOp As ManagementObject
If searcher.Get.Count > 1 Then
For Each ManObjOp In searcher.Get
Dim win32 As String = "Win32_LogicalDisk='" &
ManObjOp("Name").ToString & "'"
Dim ManObjLogD As New ManagementObject(win32)
For Each diskProperty As PropertyData In
ManObjLogD.Properties
If Not diskProperty.Value Is Nothing Then
Console.WriteLine _
("{0} = {1}", diskProperty.Name, diskProperty.Value)
End If
Next
Next
End If
///
(Probably you can use as well instead of LogicalDisk , NetworkConnection)

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 IWshRuntimeLibrary
\\\By Dennis of Houston (changed a little bit by Cor Ligthert)
Dim o As IWshNetwork2 = _
CType(CreateObject("WScript.Network"), IWshNetwork2)
Dim odrives As WshCollection = CType(o.EnumNetworkDrives, WshCollection)
Dim Drives(CInt(odrives.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.ToLower
Next
end if
///

I hope this helps?

Cor

Nov 21 '05 #2
"Dennis" <De****@discussions.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.Reflection.Assembly
myAssembly = Me.GetType.Assembly

Dim myManager As New _
System.Resources.ResourceManager("ResourceNamespac e.myResources", _
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(YourModule)

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.Resources.ResourceManager("ResourceNamespac e.myResources",
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
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: ...
0
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,...
1
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...
0
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...
5
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...
0
by: Kyle Kaitan | last post by:
Is there a managed way to both read from *and* write to embedded resources?
1
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...
2
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)...
4
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 .......
0
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...
0
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,...
0
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,...
0
jinu1996
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...
1
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...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.