D
David Hubball
Hi
Does anyone know how to do a small program to return the values in a
ListBox without it crashing.
I've tried the code below but it crashes when indexing down my ListBox
called listboxFilesToBackup.
int index = 0;
listboxFilesToBackup.SelectedIndex = index;
while (listboxFilesToBackup.SelectedItem.ToString()!="")
{
MessageBox.Show
(listboxFilesToBackup.SelectedItem.ToString());
index++;
listboxFilesToBackup.SelectedIndex = index;
}
Much Appreciate if anyone can help as I'm very new to c#. I've got
this working once by using Try Catch but just wondered if there is a
cleaner way of getting the values that I've missed.
Kind Regards
David
Does anyone know how to do a small program to return the values in a
ListBox without it crashing.
I've tried the code below but it crashes when indexing down my ListBox
called listboxFilesToBackup.
int index = 0;
listboxFilesToBackup.SelectedIndex = index;
while (listboxFilesToBackup.SelectedItem.ToString()!="")
{
MessageBox.Show
(listboxFilesToBackup.SelectedItem.ToString());
index++;
listboxFilesToBackup.SelectedIndex = index;
}
Much Appreciate if anyone can help as I'm very new to c#. I've got
this working once by using Try Catch but just wondered if there is a
cleaner way of getting the values that I've missed.
Kind Regards
David