Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- using (RegistryKey key = Registry.LocalMachine.OpenSubKey("HKEY_USERS\\"+sidString+"\\Software\\SAMP"))
- {
- if (key != null)
- {
- Object o = key.GetValue("PlayerName");
- if (o != null)
- {
- String playerName = new String(o as String); //"as" because it's REG_SZ...otherwise ToString() might be safe(r)
- txtPlayerName.Text = playerName;
- }
- }
- }
- }
- catch (Exception ex) //just for demonstration...it's always best to handle specific exceptions
- {
- //react appropriately
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement