Click here to Skip to main content
15,905,071 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to make snooker/pool/billiard in C#??? Pin
Zoltan Balazs12-Jul-07 9:27
Zoltan Balazs12-Jul-07 9:27 
GeneralRe: how to make snooker/pool/billiard in C#??? Pin
Paul Conrad12-Jul-07 9:30
professionalPaul Conrad12-Jul-07 9:30 
GeneralRe: how to make snooker/pool/billiard in C#??? Pin
Dan Neely12-Jul-07 9:52
Dan Neely12-Jul-07 9:52 
GeneralRe: how to make snooker/pool/billiard in C#??? Pin
Dan Neely12-Jul-07 9:51
Dan Neely12-Jul-07 9:51 
GeneralRe: how to make snooker/pool/billiard in C#??? Pin
chumairr12-Jul-07 19:40
chumairr12-Jul-07 19:40 
GeneralRe: how to make snooker/pool/billiard in C#??? Pin
Malcolm Smart12-Jul-07 20:59
Malcolm Smart12-Jul-07 20:59 
AnswerTHE RULES Pin
leckey12-Jul-07 8:39
leckey12-Jul-07 8:39 
QuestionCombo Box SwapItem Pin
PhilDanger12-Jul-07 6:18
PhilDanger12-Jul-07 6:18 
Hi everyone,

I'm trying to write a simple swap function for two items in a combo box (this is used for moving an item in a combo box up or down depending on the button the user clicks).

My problem is that when I set ComboBox.DroppedDown = true, when the user clicks the button again while it is dropped down, (or anywhere else besides the combo box) it switches back to selecting the index that was initially selected. This is a problem when they want to move the same item more than one position -- it doesn't follow the user's selection.
/// <summary>
/// Swaps the names of the frames in the combo box.
/// </summary>
private void SwapFrameNames(int oldIndex, int newIndex)
{
    cmbFrames.DroppedDown = true; //drop the combo box down so the user can see what's going on

    //perform the swap
    object temp = cmbFrames.Items[newIndex];
    cmbFrames.Items[newIndex] = cmbFrames.Items[oldIndex];
    cmbFrames.Items[oldIndex] = temp;

    //select the new position so we follow the user's selection
    cmbFrames.SelectedIndex = newIndex;
}


The code works fine if I comment out the first line of the function -- it follows the selection as expected.

Any ideas?

Thanks,

Phil
AnswerRe: Combo Box SwapItem Pin
Christian Graus12-Jul-07 6:28
protectorChristian Graus12-Jul-07 6:28 
GeneralRe: Combo Box SwapItem Pin
PhilDanger12-Jul-07 7:25
PhilDanger12-Jul-07 7:25 
AnswerRe: Combo Box SwapItem Pin
Luc Pattyn12-Jul-07 7:52
sitebuilderLuc Pattyn12-Jul-07 7:52 
QuestionAjax slowing my search??? Pin
Chris McGlothen12-Jul-07 6:12
Chris McGlothen12-Jul-07 6:12 
AnswerRe: Ajax slowing my search??? Pin
Christian Graus12-Jul-07 6:28
protectorChristian Graus12-Jul-07 6:28 
GeneralRe: Ajax slowing my search??? Pin
Chris McGlothen12-Jul-07 6:36
Chris McGlothen12-Jul-07 6:36 
GeneralRe: Ajax slowing my search??? Pin
Larantz12-Jul-07 12:09
Larantz12-Jul-07 12:09 
GeneralRe: Ajax slowing my search??? Pin
Chris McGlothen12-Jul-07 12:57
Chris McGlothen12-Jul-07 12:57 
GeneralRe: Ajax slowing my search??? Pin
Steve Echols12-Jul-07 15:32
Steve Echols12-Jul-07 15:32 
GeneralRe: Ajax slowing my search??? Pin
Chris McGlothen13-Jul-07 6:04
Chris McGlothen13-Jul-07 6:04 
GeneralRe: Ajax slowing my search??? Pin
Steve Echols13-Jul-07 6:14
Steve Echols13-Jul-07 6:14 
GeneralRe: Ajax slowing my search??? Pin
Larantz13-Jul-07 0:21
Larantz13-Jul-07 0:21 
GeneralRe: Ajax slowing my search??? Pin
Chris McGlothen13-Jul-07 4:34
Chris McGlothen13-Jul-07 4:34 
QuestionHelp with a search & replace Pin
rbuchana12-Jul-07 5:51
rbuchana12-Jul-07 5:51 
AnswerRe: Help with a search & replace Pin
User 665812-Jul-07 6:06
User 665812-Jul-07 6:06 
AnswerRe: Help with a search & replace Pin
Luc Pattyn12-Jul-07 6:12
sitebuilderLuc Pattyn12-Jul-07 6:12 
QuestionProblem Connecting to MQ on unix from .NET application Pin
unnamed00712-Jul-07 4:51
unnamed00712-Jul-07 4:51 

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.