Click here to Skip to main content
15,907,687 members
Home / Discussions / C#
   

C#

 
GeneralRe: COM+ Catalog Infomation Pin
Heath Stewart30-Jan-04 13:08
protectorHeath Stewart30-Jan-04 13:08 
GeneralRe: COM+ Catalog Infomation Pin
kimsangwoo30-Jan-04 13:58
kimsangwoo30-Jan-04 13:58 
GeneralDataTable and Xml Schemas Pin
MrJJKoolJ29-Jan-04 14:08
MrJJKoolJ29-Jan-04 14:08 
GeneralRe: DataTable and Xml Schemas Pin
MrJJKoolJ29-Jan-04 14:41
MrJJKoolJ29-Jan-04 14:41 
GeneralRe: DataTable and Xml Schemas Pin
Kentamanos29-Jan-04 16:39
Kentamanos29-Jan-04 16:39 
GeneralRe: DataTable and Xml Schemas Pin
MrJJKoolJ29-Jan-04 16:49
MrJJKoolJ29-Jan-04 16:49 
GeneralRe: DataTable and Xml Schemas Pin
Heath Stewart30-Jan-04 3:40
protectorHeath Stewart30-Jan-04 3:40 
GeneralError Messages Pin
BP12829-Jan-04 13:12
BP12829-Jan-04 13:12 
GeneralRe: Error Messages Pin
Colin Angus Mackay29-Jan-04 14:36
Colin Angus Mackay29-Jan-04 14:36 
GeneralRe: Error Messages Pin
BP12829-Jan-04 15:42
BP12829-Jan-04 15:42 
GeneralRe: Error Messages Pin
Kentamanos29-Jan-04 16:10
Kentamanos29-Jan-04 16:10 
GeneralRe: Error Messages Pin
BP12829-Jan-04 16:32
BP12829-Jan-04 16:32 
GeneralRe: Error Messages Pin
Kentamanos29-Jan-04 16:36
Kentamanos29-Jan-04 16:36 
GeneralRe: Error Messages Pin
BP12829-Jan-04 16:37
BP12829-Jan-04 16:37 
GeneralRe: Error Messages Pin
Kentamanos29-Jan-04 16:49
Kentamanos29-Jan-04 16:49 
GeneralRe: Error Messages Pin
BP12829-Jan-04 16:51
BP12829-Jan-04 16:51 
GeneralRe: Error Messages Pin
BP12829-Jan-04 18:01
BP12829-Jan-04 18:01 
GeneralRe: Error Messages Pin
Heath Stewart30-Jan-04 3:34
protectorHeath Stewart30-Jan-04 3:34 
GeneralSecurity Issues Pin
Ken Galer29-Jan-04 10:26
Ken Galer29-Jan-04 10:26 
GeneralRe: Security Issues Pin
Heath Stewart29-Jan-04 13:16
protectorHeath Stewart29-Jan-04 13:16 
GeneralRe: Security Issues Pin
Ken Galer30-Jan-04 2:23
Ken Galer30-Jan-04 2:23 
GeneralRe: Security Issues Pin
Heath Stewart30-Jan-04 3:23
protectorHeath Stewart30-Jan-04 3:23 
GeneralOver ride closing event Pin
Daniel Negron29-Jan-04 9:27
Daniel Negron29-Jan-04 9:27 
GeneralRe: Over ride closing event Pin
Heath Stewart29-Jan-04 13:08
protectorHeath Stewart29-Jan-04 13:08 
GeneralListbox deleting items Pin
Gavin Coates29-Jan-04 8:19
Gavin Coates29-Jan-04 8: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

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.