G
Guest
i have an application in VB .NET. I am trying to get UserName and Domain from
my Computer using the following code and it was working properly until i
reinstalled Visual Studio .NET (i had an other problem). I am not sure tha
this action generated the problem, but i don't know what to check to see what
is the problem.
'--------------------------------------------------------------------------
Dim results As clsWMIDomainUsers = New clsWMIDomainUsers
Dim srchr As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT
* FROM Win32_ComputerSystem")
Dim coll As ManagementObjectCollection
Dim mo As ManagementObject
coll = srchr.Get
For Each mo In coll
results.FullyQualifiedUserName = CStr(mo.Item("UserName"))
results.DefaultDomainController = CStr(mo.Item("Domain"))
SplitDomainAndUserName(results)
Exit For
Next
'-------------------------------------------------------------------
When the "For Each mo In coll" is executing the following error is generate
"A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll" and
nothing else...
Any help please???
my Computer using the following code and it was working properly until i
reinstalled Visual Studio .NET (i had an other problem). I am not sure tha
this action generated the problem, but i don't know what to check to see what
is the problem.
'--------------------------------------------------------------------------
Dim results As clsWMIDomainUsers = New clsWMIDomainUsers
Dim srchr As ManagementObjectSearcher = New ManagementObjectSearcher("SELECT
* FROM Win32_ComputerSystem")
Dim coll As ManagementObjectCollection
Dim mo As ManagementObject
coll = srchr.Get
For Each mo In coll
results.FullyQualifiedUserName = CStr(mo.Item("UserName"))
results.DefaultDomainController = CStr(mo.Item("Domain"))
SplitDomainAndUserName(results)
Exit For
Next
'-------------------------------------------------------------------
When the "For Each mo In coll" is executing the following error is generate
"A first chance exception of type
'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll" and
nothing else...
Any help please???