Click here to Skip to main content
15,890,186 members
Home / Discussions / C#
   

C#

 
Questionwhere i need to declare my array? Pin
kaka76023-Mar-09 8:39
kaka76023-Mar-09 8:39 
AnswerRe: where i need to declare my array? Pin
Samuel Cherinet23-Mar-09 8:52
Samuel Cherinet23-Mar-09 8:52 
AnswerRe: where i need to declare my array? Pin
Vitaliy Tsvayer23-Mar-09 8:56
Vitaliy Tsvayer23-Mar-09 8:56 
QuestionArranging more than one image having transparent pixels.... Pin
Umangj23-Mar-09 8:00
Umangj23-Mar-09 8:00 
AnswerRe: Arranging more than one image having transparent pixels.... Pin
Samuel Cherinet23-Mar-09 8:08
Samuel Cherinet23-Mar-09 8:08 
GeneralRe: Arranging more than one image having transparent pixels.... Pin
Umangj23-Mar-09 8:20
Umangj23-Mar-09 8:20 
AnswerRe: Arranging more than one image having transparent pixels.... Pin
Vitaliy Tsvayer23-Mar-09 8:33
Vitaliy Tsvayer23-Mar-09 8:33 
QuestionAdding two types into an array? Pin
bbranded23-Mar-09 7:35
bbranded23-Mar-09 7:35 
Hello,

I'm attempting to enumerate the contents of a registry key: HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop

I am currently storing the Name in an array without a problem.

However, how do I store both a REG_BINARY (byte) and a REG_DWORD (int) into an array?

Here is the code, that is failing:

<br />
RegistryKey myRegKey = Registry.CurrentUser;<br />
myRegKey = myRegKey.OpenSubKey("Software\\Microsoft\\Windows\\Shell\\Bags\\1\\Desktop\\");<br />
String[] valueNames = myRegKey.GetValueNames();<br />
<br />
string[] OriginalValueName = new string[valueNames.Length];<br />
Byte[] OriginalValueData = new System.Byte[valueNames.Length];<br />
<br />
int i = 0;<br />
foreach (String valuename in valueNames)<br />
{<br />
    MessageBox.Show(valuename);<br />
    OriginalValueName[i] = valuename;<br />
<br />
    Object ovalue = myRegKey.GetValue(valuename);<br />
    MessageBox.Show(ovalue.ToString());<br />
<br />
    if (ovalue.ToString() == "System.Byte[]")<br />
    {<br />
        OriginalValueData[i] = (System.Byte)ovalue;<br />
    }<br />
    else<br />
    {<br />
        OriginalValueData[i] = (System.Byte)ovalue; //Specified cast is invalid<br />
    }<br />
}


I'm trying to convert an integer to a byte, but it doesn't seem to work, claiming "Specified cast is invalid."


Does anyone have any ideas?


Thanks,

Matt
AnswerRe: Adding two types into an array? Pin
Luc Pattyn23-Mar-09 7:43
sitebuilderLuc Pattyn23-Mar-09 7:43 
GeneralRe: Adding two types into an array? Pin
led mike23-Mar-09 7:47
led mike23-Mar-09 7:47 
GeneralRe: Adding two types into an array? Pin
Luc Pattyn23-Mar-09 8:03
sitebuilderLuc Pattyn23-Mar-09 8:03 
GeneralRe: Adding two types into an array? Pin
bbranded23-Mar-09 7:49
bbranded23-Mar-09 7:49 
GeneralRe: Adding two types into an array? Pin
bbranded23-Mar-09 7:57
bbranded23-Mar-09 7:57 
GeneralRe: Adding two types into an array? Pin
Luc Pattyn23-Mar-09 8:07
sitebuilderLuc Pattyn23-Mar-09 8:07 
GeneralRe: Adding two types into an array? Pin
bbranded23-Mar-09 8:57
bbranded23-Mar-09 8:57 
GeneralRe: Adding two types into an array? Pin
Luc Pattyn23-Mar-09 9:03
sitebuilderLuc Pattyn23-Mar-09 9:03 
GeneralRe: Adding two types into an array? Pin
bbranded23-Mar-09 9:10
bbranded23-Mar-09 9:10 
GeneralRe: Adding two types into an array? Pin
Luc Pattyn23-Mar-09 9:14
sitebuilderLuc Pattyn23-Mar-09 9:14 
AnswerRe: Adding two types into an array? Pin
Samuel Cherinet23-Mar-09 7:46
Samuel Cherinet23-Mar-09 7:46 
AnswerRe: Adding two types into an array? Pin
PIEBALDconsult23-Mar-09 16:16
mvePIEBALDconsult23-Mar-09 16:16 
QuestionLog file Pin
mrithula823-Mar-09 7:20
mrithula823-Mar-09 7:20 
AnswerRe: Log file Pin
Alan N23-Mar-09 7:35
Alan N23-Mar-09 7:35 
GeneralRe: Log file Pin
Vitaliy Tsvayer23-Mar-09 8:43
Vitaliy Tsvayer23-Mar-09 8:43 
GeneralRe: Log file Pin
mrithula823-Mar-09 18:57
mrithula823-Mar-09 18:57 
Questionfinding variables and method names in a source code Pin
emyl2123-Mar-09 7:17
emyl2123-Mar-09 7:17 

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.