Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Reading registry values

Reading registry values

Scheduled Pinned Locked Moved C#
databasewindows-admin
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheJudeDude
    wrote on last edited by
    #1

    I am trying to get the Computer's name in the registry under HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName with the following: string strCompName = (string)Registry.LocalMachine.GetValue("SYSTEM\\ControlSet001\\Control\\ComputerName\\ComputerName\\ComputerName"); But I am getting a null value. BTW I did search the forum, but every post I clicked on from the query sent me to the main forum page. Thanx in advance!

    Jude

    T K 2 Replies Last reply
    0
    • T TheJudeDude

      I am trying to get the Computer's name in the registry under HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName with the following: string strCompName = (string)Registry.LocalMachine.GetValue("SYSTEM\\ControlSet001\\Control\\ComputerName\\ComputerName\\ComputerName"); But I am getting a null value. BTW I did search the forum, but every post I clicked on from the query sent me to the main forum page. Thanx in advance!

      Jude

      T Offline
      T Offline
      TheJudeDude
      wrote on last edited by
      #2

      Figured it out. I thought that RegistryKey.CreateSubKey() would create values, but it reads the subkey.

      Jude

      1 Reply Last reply
      0
      • T TheJudeDude

        I am trying to get the Computer's name in the registry under HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName with the following: string strCompName = (string)Registry.LocalMachine.GetValue("SYSTEM\\ControlSet001\\Control\\ComputerName\\ComputerName\\ComputerName"); But I am getting a null value. BTW I did search the forum, but every post I clicked on from the query sent me to the main forum page. Thanx in advance!

        Jude

        K Offline
        K Offline
        Kristian Sixhoj
        wrote on last edited by
        #3

        This can be accomplished in an easier way: Environment.MachineName will return the computers NetBIOS name. (If that's what you're looking for).

        Kristian Sixhoej


        "Failure is not an option" - Gene Kranz

        T 1 Reply Last reply
        0
        • K Kristian Sixhoj

          This can be accomplished in an easier way: Environment.MachineName will return the computers NetBIOS name. (If that's what you're looking for).

          Kristian Sixhoej


          "Failure is not an option" - Gene Kranz

          T Offline
          T Offline
          TheJudeDude
          wrote on last edited by
          #4

          Heh! That easy!?!?! Thanx for the reply. What I am trying to accomplish is connection to an MSDE on the fly. So far I got it working!

          Jude

          P 1 Reply Last reply
          0
          • T TheJudeDude

            Heh! That easy!?!?! Thanx for the reply. What I am trying to accomplish is connection to an MSDE on the fly. So far I got it working!

            Jude

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            Why not just use localhost?

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups