Click here to Skip to main content
15,851,387 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error Messages Pin
Heath Stewart30-Jan-04 4:34
protectorHeath Stewart30-Jan-04 4:34 
GeneralSecurity Issues Pin
Ken Galer29-Jan-04 11:26
Ken Galer29-Jan-04 11:26 
GeneralRe: Security Issues Pin
Heath Stewart29-Jan-04 14:16
protectorHeath Stewart29-Jan-04 14:16 
GeneralRe: Security Issues Pin
Ken Galer30-Jan-04 3:23
Ken Galer30-Jan-04 3:23 
GeneralRe: Security Issues Pin
Heath Stewart30-Jan-04 4:23
protectorHeath Stewart30-Jan-04 4:23 
GeneralOver ride closing event Pin
Daniel Negron29-Jan-04 10:27
Daniel Negron29-Jan-04 10:27 
GeneralRe: Over ride closing event Pin
Heath Stewart29-Jan-04 14:08
protectorHeath Stewart29-Jan-04 14:08 
GeneralListbox deleting items Pin
Gavin Coates29-Jan-04 9:19
Gavin Coates29-Jan-04 9:19 
I seem to be encountering difficulty while trying to delete an item from a listbox. The user selects an item from the listbox, then clicks a delete button. The button code is as follows:

<br />
try<br />
{<br />
listBox1.Items.Remove(listBox1.SelectedItem);<br />
}<br />
catch(IndexOutOfRangeException ex)<br />
{<br />
 MessageBox.Show("Could not delete the selected item", "Error", MessageBoxButtons.OK);<br />
}<br />
<br />


Now, if I select the first item in the list, and press delete, the exception IndexOutOfRange occurs, however the item is then successfully deleted. If I select any other item in the list and try to delete it, it works fine, no exception

Why does deleting the first item cause an exception
GeneralRe: Listbox deleting items Pin
Mazdak29-Jan-04 9:28
Mazdak29-Jan-04 9:28 
GeneralRe: Listbox deleting items Pin
Gavin Coates29-Jan-04 10:09
Gavin Coates29-Jan-04 10:09 
GeneralRe: Listbox deleting items Pin
Mazdak29-Jan-04 10:14
Mazdak29-Jan-04 10:14 
GeneralRe: Listbox deleting items Pin
Gavin Coates29-Jan-04 10:52
Gavin Coates29-Jan-04 10:52 
GeneralRe: Listbox deleting items Pin
thomasa30-Jan-04 1:45
thomasa30-Jan-04 1:45 
GeneralRe: Listbox deleting items Pin
Gavin Coates31-Jan-04 11:17
Gavin Coates31-Jan-04 11:17 
GeneralRe: Listbox deleting items Pin
thomasa1-Feb-04 23:14
thomasa1-Feb-04 23:14 
GeneralMulti-threading Pin
Guinness4Strength29-Jan-04 6:17
Guinness4Strength29-Jan-04 6:17 
GeneralRe: Multi-threading Pin
scadaguy29-Jan-04 11:23
scadaguy29-Jan-04 11:23 
GeneralRe: Multi-threading Pin
Guinness4Strength29-Jan-04 11:27
Guinness4Strength29-Jan-04 11:27 
GeneralRe: Multi-threading Pin
Heath Stewart29-Jan-04 13:55
protectorHeath Stewart29-Jan-04 13:55 
GeneralDatabase Problem, PLEASE HELP Pin
gls2ro29-Jan-04 5:24
gls2ro29-Jan-04 5:24 
Generalconvert web form to windows form Pin
OmegaSupreme29-Jan-04 5:19
OmegaSupreme29-Jan-04 5:19 
GeneralRe: convert web form to windows form Pin
Colin Angus Mackay29-Jan-04 15:40
Colin Angus Mackay29-Jan-04 15:40 
GeneralRe: convert web form to windows form Pin
OmegaSupreme30-Jan-04 0:43
OmegaSupreme30-Jan-04 0:43 
GeneralRe: convert web form to windows form Pin
Kentamanos29-Jan-04 20:22
Kentamanos29-Jan-04 20:22 
GeneralRe: convert web form to windows form Pin
OmegaSupreme30-Jan-04 0:48
OmegaSupreme30-Jan-04 0:48 

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.