Click here to Skip to main content
15,513,571 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Battleship gameboard & random assignment Pin
Otto_W13-Oct-22 18:45
Otto_W13-Oct-22 18:45 
GeneralRe: C# Battleship gameboard & random assignment Pin
Otto_W13-Oct-22 18:46
Otto_W13-Oct-22 18:46 
GeneralRe: C# Battleship gameboard & random assignment Pin
Otto_W25-Oct-22 18:16
Otto_W25-Oct-22 18:16 
GeneralRe: C# Battleship gameboard & random assignment Pin
OriginalGriff25-Oct-22 20:34
mveOriginalGriff25-Oct-22 20:34 
GeneralRe: C# Battleship gameboard & random assignment Pin
Otto_W30-Oct-22 20:30
Otto_W30-Oct-22 20:30 
GeneralRe: C# Battleship gameboard & random assignment Pin
Otto_W15-Nov-22 15:46
Otto_W15-Nov-22 15:46 
AnswerRe: C# Battleship gameboard & random assignment Pin
Gerry Schmitz6-Sep-22 6:06
mveGerry Schmitz6-Sep-22 6:06 
QuestionChanging Windows registry with C# Pin
Ismael_199931-Aug-22 13:50
Ismael_199931-Aug-22 13:50 
Hi. I'm working with Visual Studio on a application that changes a windows registry. There is a small forms that requests an address in a text box. The contents of the text box wil be writen is the registry. I need the key to be LocalMachine and here is a snippet of this code:
private void button1_Click(object sender, EventArgs e)
{
    RegistryKey chaveBase, chave;
    chaveBase = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
    chave = chaveBase.CreateSubKey("Software\\Antares", true);
    chave.SetValue("Endereço", textBox1.Text);
}

The problem is that I receive the message: "System.UnauthorizedAccessException: 'Access to the registry key 'HKEY_LOCAL_MACHINE\Software\Antares' is denied".
If I change LocalMachine for CurrentUser, it works fine. What should I do to access LocalMachine?
AnswerRe: Changing Windows registry with C# Pin
Dave Kreskowiak31-Aug-22 15:37
mveDave Kreskowiak31-Aug-22 15:37 
GeneralRe: Changing Windows registry with C# Pin
Ismael_19993-Sep-22 5:18
Ismael_19993-Sep-22 5:18 
GeneralRe: Changing Windows registry with C# Pin
Dave Kreskowiak3-Sep-22 10:51
mveDave Kreskowiak3-Sep-22 10:51 
AnswerRe: Changing Windows registry with C# Pin
OriginalGriff31-Aug-22 19:51
mveOriginalGriff31-Aug-22 19:51 
GeneralRe: Changing Windows registry with C# Pin
Ismael_19993-Sep-22 5:20
Ismael_19993-Sep-22 5:20 
GeneralRe: Changing Windows registry with C# Pin
OriginalGriff3-Sep-22 5:43
mveOriginalGriff3-Sep-22 5:43 
GeneralRe: Changing Windows registry with C# Pin
Ismael_19994-Sep-22 12:41
Ismael_19994-Sep-22 12:41 
GeneralRe: Changing Windows registry with C# Pin
Dave Kreskowiak4-Sep-22 14:12
mveDave Kreskowiak4-Sep-22 14:12 
GeneralRe: Changing Windows registry with C# Pin
OriginalGriff4-Sep-22 20:19
mveOriginalGriff4-Sep-22 20:19 
GeneralRe: Changing Windows registry with C# Pin
Dave Kreskowiak5-Sep-22 4:43
mveDave Kreskowiak5-Sep-22 4:43 
GeneralRe: Changing Windows registry with C# Pin
Ismael_19996-Sep-22 5:10
Ismael_19996-Sep-22 5:10 
GeneralRe: Changing Windows registry with C# Pin
Dave Kreskowiak6-Sep-22 5:30
mveDave Kreskowiak6-Sep-22 5:30 
GeneralRe: Changing Windows registry with C# Pin
Ismael_19996-Sep-22 5:47
Ismael_19996-Sep-22 5:47 
GeneralRe: Changing Windows registry with C# Pin
Dave Kreskowiak6-Sep-22 5:48
mveDave Kreskowiak6-Sep-22 5:48 
GeneralRe: Changing Windows registry with C# Pin
Ismael_19996-Sep-22 11:29
Ismael_19996-Sep-22 11:29 
GeneralRe: Changing Windows registry with C# Pin
Dave Kreskowiak6-Sep-22 11:31
mveDave Kreskowiak6-Sep-22 11:31 
GeneralRe: Changing Windows registry with C# Pin
Ismael_19998-Sep-22 14:00
Ismael_19998-Sep-22 14:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.