Click here to Skip to main content
15,922,015 members
Home / Discussions / C#
   

C#

 
Questionproblem with creating a messagequeue Pin
prasadbuddhika27-Oct-08 9:10
prasadbuddhika27-Oct-08 9:10 
AnswerRe: problem with creating a messagequeue Pin
manfred.bjorlin27-Oct-08 9:14
manfred.bjorlin27-Oct-08 9:14 
QuestionProblems with deserialization of MessageQueue Message Pin
manfred.bjorlin27-Oct-08 9:04
manfred.bjorlin27-Oct-08 9:04 
AnswerRe: Problems with deserialization of MessageQueue Message Pin
Le centriste27-Oct-08 9:33
Le centriste27-Oct-08 9:33 
GeneralRe: Problems with deserialization of MessageQueue Message Pin
manfred.bjorlin28-Oct-08 0:01
manfred.bjorlin28-Oct-08 0:01 
GeneralRe: Problems with deserialization of MessageQueue Message Pin
Le centriste28-Oct-08 2:19
Le centriste28-Oct-08 2:19 
GeneralRe: Problems with deserialization of MessageQueue Message Pin
manfred.bjorlin28-Oct-08 2:29
manfred.bjorlin28-Oct-08 2:29 
QuestionBuilding a FAT emulator Pin
Gianpaolo Barci27-Oct-08 7:23
Gianpaolo Barci27-Oct-08 7:23 
AnswerRe: Building a FAT emulator Pin
Michael Bookatz27-Oct-08 7:32
Michael Bookatz27-Oct-08 7:32 
GeneralRe: Building a FAT emulator Pin
Gianpaolo Barci27-Oct-08 7:48
Gianpaolo Barci27-Oct-08 7:48 
GeneralRe: Building a FAT emulator Pin
User 665827-Oct-08 11:33
User 665827-Oct-08 11:33 
QuestionDeleting Items and Selecting next one on ListBox on C# Pin
three.leaf27-Oct-08 6:33
three.leaf27-Oct-08 6:33 
AnswerRe: Deleting Items and Selecting next one on ListBox on C# Pin
Parwej Ahamad27-Oct-08 7:25
professionalParwej Ahamad27-Oct-08 7:25 
AnswerRe: Deleting Items and Selecting next one on ListBox on C# Pin
Michael Bookatz27-Oct-08 7:30
Michael Bookatz27-Oct-08 7:30 
GeneralRe: Deleting Items and Selecting next one on ListBox on C# Pin
three.leaf27-Oct-08 10:36
three.leaf27-Oct-08 10:36 
AnswerRe: Deleting Items and Selecting next one on ListBox on C# Pin
#realJSOP27-Oct-08 9:16
professional#realJSOP27-Oct-08 9:16 
GeneralRe: Deleting Items and Selecting next one on ListBox on C# Pin
three.leaf27-Oct-08 17:08
three.leaf27-Oct-08 17:08 
GeneralRe: Deleting Items and Selecting next one on ListBox on C# Pin
#realJSOP28-Oct-08 0:26
professional#realJSOP28-Oct-08 0:26 
Try this:

int index = listBox1.SelectedIndex;
if (index >= 0)
{
    listBox1.Items.RemoveAt(index);
    Reestablecer();
    // you only need to change the selected index if it is > the new last item
    int lastItem = listBox1.Items.Count - 1;

    // if there are items in the listbox
    if (lastItem >= 0)
    {
        // if the current index is > than the last item
        if (index > lastItem)
        {
            // change the selected index
            listBox1.SelectedIndex = lastItem;
        }
    }
    else
    {
        // no items in the listbox, so we make the selected index -1
        listBox1.SelectedIndex = -1;
    }
}



"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001


GeneralRe: Deleting Items and Selecting next one on ListBox on C# Pin
#realJSOP28-Oct-08 1:13
professional#realJSOP28-Oct-08 1:13 
QuestionHow to select multiple rows in a DataGrid? Pin
chicago7627-Oct-08 6:25
chicago7627-Oct-08 6:25 
GeneralRe: How to select multiple rows in a DataGrid? Pin
nelsonpaixao27-Oct-08 13:19
nelsonpaixao27-Oct-08 13:19 
QuestionMy Favorites Tab Pin
boiDev27-Oct-08 6:12
boiDev27-Oct-08 6:12 
QuestionRe: My Favorites Tab Pin
led mike27-Oct-08 7:05
led mike27-Oct-08 7:05 
AnswerRe: My Favorites Tab Pin
Ashfield27-Oct-08 9:41
Ashfield27-Oct-08 9:41 
QuestionAdd to view binded to gridview Pin
sepel27-Oct-08 5:18
sepel27-Oct-08 5:18 

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.