Embedded Resources and ResourceManager

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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("ResourceNamespace.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,

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/d...fsystemenvironmentclassgetfolderpathtopic.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
 
Dennis said:
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("ResourceNamespace.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.
 
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
////
 
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.
 
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("ResourceNamespace.myResources",
t.Assembly)

Hope that helps you.
Regards,
-Adam.
 
Back
Top