Click here to Skip to main content
15,895,462 members
Home / Discussions / C#
   

C#

 
QuestionRecord in Txt Pin
Can_8528-Sep-07 1:56
Can_8528-Sep-07 1:56 
AnswerRe: Record in Txt Pin
Colin Angus Mackay28-Sep-07 2:00
Colin Angus Mackay28-Sep-07 2:00 
QuestionREFRESH the database after updating Pin
prasadbuddhika28-Sep-07 1:50
prasadbuddhika28-Sep-07 1:50 
AnswerRe: REFRESH the database after updating Pin
Malcolm Smart28-Sep-07 2:38
Malcolm Smart28-Sep-07 2:38 
QuestionProblem with font and GDI+ Pin
Bin2Hex28-Sep-07 1:39
Bin2Hex28-Sep-07 1:39 
Questioninserting control into DataGridView rows Pin
half-life28-Sep-07 1:22
half-life28-Sep-07 1:22 
AnswerRe: inserting control into DataGridView rows Pin
half-life28-Sep-07 1:35
half-life28-Sep-07 1:35 
QuestionGetting REG_MULTI_SZ values into a listbox Pin
Lucy28-Sep-07 0:24
Lucy28-Sep-07 0:24 
Hi
I have 2 listboxes on my form and in the form load event I want to get values from specified registry keys to appear as items in to each listbox. The first listbox works fine using this code:

RegistryKey key1 = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\RegKey_test");
if (key1.GetValue("MultiString1") != null)
{
ListBox1.Items.Clear();
string[] items = (string[])key1.GetValue("MultiString1");
for (int i = 0; i < items.Length; i++)
{
ListBox1.Items.Add(key1.GetValue("MultiString1", items[i]));
}
}


But for the second listbox I have practically the exact same code (But with a different registry value name and listbox). However, when the form loads ListBox1 shows the correct values but ListBox2 shows 'String[]Array' for each number of multistring values. Here is my code for getting the values from "MultiString2" into ListBox2:

RegistryKey key2 = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\RegKey_test");

if (key2.GetValue("MultiString2") != null)
{
ListBox2.Items.Clear();
string[] items = (string[])key2.GetValue("MultiString2");
for (int i = 0; i < items.Length; i++)
{
ListBox2.Items.Add(key2.GetValue("MultiString2", items[i]));
}
}

Why do I have this error when both sections of code are not that different? Can anyone advise me please?

Lucy
QuestionRe: Getting REG_MULTI_SZ values into a listbox [modified] Pin
Lucy28-Sep-07 1:53
Lucy28-Sep-07 1:53 
AnswerRe: Getting REG_MULTI_SZ values into a listbox Pin
Dave Kreskowiak28-Sep-07 7:46
mveDave Kreskowiak28-Sep-07 7:46 
QuestionWindows Service. Pin
André Stroebel28-Sep-07 0:19
André Stroebel28-Sep-07 0:19 
AnswerRe: Windows Service. Pin
Pete O'Hanlon28-Sep-07 0:43
mvePete O'Hanlon28-Sep-07 0:43 
GeneralRe: Windows Service. Pin
André Stroebel28-Sep-07 0:56
André Stroebel28-Sep-07 0:56 
AnswerRe: Windows Service. Pin
Vikram A Punathambekar28-Sep-07 0:48
Vikram A Punathambekar28-Sep-07 0:48 
GeneralRe: Windows Service. Pin
André Stroebel28-Sep-07 1:24
André Stroebel28-Sep-07 1:24 
AnswerRe: Windows Service. Pin
André Stroebel28-Sep-07 2:41
André Stroebel28-Sep-07 2:41 
AnswerRe: Windows Service. Pin
PIEBALDconsult28-Sep-07 4:56
mvePIEBALDconsult28-Sep-07 4:56 
JokeRe: Windows Service. Pin
ESTAN28-Sep-07 9:51
ESTAN28-Sep-07 9:51 
GeneralRe: Windows Service. Pin
André Stroebel30-Sep-07 21:21
André Stroebel30-Sep-07 21:21 
Questionrestoring a hidden windows application ? Pin
cmpeng3428-Sep-07 0:01
cmpeng3428-Sep-07 0:01 
AnswerRe: restoring a hidden windows application ? Pin
Pete O'Hanlon28-Sep-07 0:49
mvePete O'Hanlon28-Sep-07 0:49 
GeneralMessage Closed Pin
28-Sep-07 1:05
cmpeng3428-Sep-07 1:05 
GeneralRe: restoring a hidden windows application ? Pin
Pete O'Hanlon28-Sep-07 2:01
mvePete O'Hanlon28-Sep-07 2:01 
GeneralMessage Closed Pin
28-Sep-07 3:19
cmpeng3428-Sep-07 3:19 
GeneralRe: restoring a hidden windows application ? Pin
Pete O'Hanlon28-Sep-07 3:43
mvePete O'Hanlon28-Sep-07 3:43 

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.