Results 1 to 5 of 5

Thread: [RESOLVED] Getting machine name...

  1. #1

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    Resolved [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]

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  3. #3

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    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]

  4. #4
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    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
    Pete Vickers
    MVP - Device Application Development
    http://www.gui-innovations.com http://mobileworld.appamundi.com/blogs/

  5. #5

    Thread Starter
    PowerPoster Pasvorto's Avatar
    Join Date
    Oct 2002
    Location
    Minnesota, USA
    Posts
    2,951

    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
  •  



Click Here to Expand Forum to Full Width