|
-
Aug 28th, 2007, 09:08 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Getting machine name...
It does not like this code:
MsgBox("Computer Name: " & Environment.MachineName)
The "Envronment.machineName causes the problem.
What I want to do it write a program, on the scanner, that determines which scanner, of a possible 9, I am dealing with.
I plan to name them "Scanner1", "Scanner2", etc
It will create a diifferent output file for each scanner. Later, they will be downloaded to a PC and merged into the database.
I am stuck on determining the name of the mobile device. I have been searching to no avail.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Aug 28th, 2007, 09:50 AM
#2
Frenzied Member
Re: Getting machine name...
Hi,
you can certainly get it from the registry (hkey_local_machine\ident\name), but I can't remember offhand if there is a namespace that allows you to retrieve it.
Will look it up when I get home later
Pete
-
Aug 28th, 2007, 01:23 PM
#3
Thread Starter
PowerPoster
Re: Getting machine name...
I have been shuffling through all the choices (from the tool pop ups). I can't find a way to get to the registry fields.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Aug 28th, 2007, 02:36 PM
#4
Frenzied Member
Re: Getting machine name...
Hi,
Code:
Private RegistryKey As Microsoft.Win32.RegistryKey
...
Dim strDevice as string
Dim iLoop As Integer
RegistryKey = Microsoft.Win32.Registry.LocalMachine.CreateSubKey("Ident")
For iLoop = 0 To RegistryKey.ValueCount - 1
If RegistryKey.GetValueNames(iLoop) = "Name" Then
strDevice = RegistryKey.GetValue("Name")
Exit For
End If
Next
RegistryKey.Close()
That should do it - as I say, I think there may be an easier way but...
Pete
-
Aug 28th, 2007, 02:50 PM
#5
Thread Starter
PowerPoster
Re: Getting machine name...
Therei s an easier way. It seems to work. haven't put it through any "hard core" testing yet.
Dim machinename As String = ""
machinename = System.Net.Dns.GetHostName
That retrieved the proper name on the test scanner.
===================================================
If your question has been answered, mark the thread as [RESOLVED]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|