Groups | Blog | Home
all groups > c# > november 2006 >

c# : what property or method should I use in combo box to


Amanda
11/2/2006 10:53:54 PM
User is going to be transferring items out of combobox to listbox and
vice versa keeping ascending and desending order respectively at all
time.

If user selects the last item in combobox, the program is supposed to
display a message box stating that there is no more item in the
combobox with OK button to be clicked as the only option and upon
clicking OK, the program should terminate, i.e the program should check
to ensure that the ComboBox contains at least one item.

What property or method should I use to check that the user has
selected the last item left in combo box? Or should I just keep track
of the count of items and when the last one is selected, display the
message and terminate the program?
Amanda
11/2/2006 11:06:39 PM
Never mind. Got that part.

Now, how do I set descending order for list box?
Michael Nemtsev
11/3/2006 1:17:02 AM
There are 2 cases
1) Use Array.Sort + Array.Reverse
2) Override ListBox.Sort in custom class inherited from ListBox

--
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche




[quoted text, click to view]
Amanda
11/3/2006 6:44:58 AM

[quoted text, click to view]

We can't use array in this assignment yet. No inheritance either.



[quoted text, click to view]
Amanda
11/3/2006 9:35:22 AM

[quoted text, click to view]

Data is placed at design time in combo box. At runt ime, move back and
forth (as long as at leats one entry is left in combo box) to the list
box but the data must be in descending order in list box at all time.

I set sort property to true in design time for both combo and list box
which by default, it seems is ascending order.



[quoted text, click to view]
Amanda
11/3/2006 11:05:06 AM

[quoted text, click to view]

Thanks.


[quoted text, click to view]
Michael Nemtsev
11/3/2006 5:10:12 PM
Hello Amanda,

How do u fill up the ListBox? With DataSet/DataTable?

[quoted text, click to view]
A> We can't use array in this assignment yet. No inheritance either.
A>
[quoted text, click to view]
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Michael Nemtsev
11/3/2006 5:50:03 PM
Hello Amanda,

There is no other way for desc sort except I described -data sort or override
Sort of ListBox control

[quoted text, click to view]
A> Data is placed at design time in combo box. At runt ime, move back
A> and forth (as long as at leats one entry is left in combo box) to the
A> list box but the data must be in descending order in list box at all
A> time.
A>
A> I set sort property to true in design time for both combo and list
A> box which by default, it seems is ascending order.
A>
[quoted text, click to view]
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

AddThis Social Bookmark Button