I tried many many ways to Convert a value to String so part of my tool set I made a form that will tell you your HWID HardWare ID. I found the registry with the value in it.
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\IDConfigDB\Hardware Profiles\0001"\HwProfileGuid"
-> This gives long test string
I want to Discord that on a label I tried all ways i know But none work My latest one I tried is
Microsoft.Win32.RegistryKey key3;
key3 = "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\IDConfigDB\Hardware Profiles\0001\HwProfileGuid2";
So this is my code:
string regg = (string)key3.GetValue("");
label2.Text = regg;
I got that code form here
but it gives an error saying :
Cannot implicitly convert type 'string' to 'Microsoft.Win32.RegistryKey'
I looked all over google what now, but they are always talking about something else. No matter how I tried it gave some error. I just want to display the HWID Value on button click to a label.
I'm using C# Visual Studio 2017.
I even tried
try
{
label2.Text = Registry.LocalMachine.OpenSubKey("SYSTEM\\ControlSet001\\Control\\IDConfigDB\\Hardware Profiles\\0001\\", true).GetValue("HwProfileGuid");
}
catch(Exception ex)
{
}
says now: Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)