String Problem
-
Hi All, I am filling numbers in a listBox. for(int i =;i<20;i++) { CString string; string.Format(i); ListBox.Addstring(string); } the output is like 0 1 10 11 12 .. .. .. .. 19 2 3 4 5 6 7 8 9 Can anypne tell how to get the numbers in order and not like this..
-
Hi All, I am filling numbers in a listBox. for(int i =;i<20;i++) { CString string; string.Format(i); ListBox.Addstring(string); } the output is like 0 1 10 11 12 .. .. .. .. 19 2 3 4 5 6 7 8 9 Can anypne tell how to get the numbers in order and not like this..
-
Hi hraman, Remove the 'sort' style of your list box and everything will be alright. Best Regards, Jijo.
_____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.
-
Hi I used a while loop and i am having the same problem while(i<20) { CString string; string.Format(i); ListBox.Addstring(string); ++i; } Can u please be bit detailed on what u mean by Sort? Thanks!!!!
By default,
Visual Studio
sets theLBS_SORT
style (forcing alphabetic sort) when adds aListbox
control to your window. To remove it, in theResource View
pane, select theListbox
and then set theSort
property toFalse
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
By default,
Visual Studio
sets theLBS_SORT
style (forcing alphabetic sort) when adds aListbox
control to your window. To remove it, in theResource View
pane, select theListbox
and then set theSort
property toFalse
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
You are welcome. BTW: I really don't know why they think alphabetic sort should be the default. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
You are welcome. BTW: I really don't know why they think alphabetic sort should be the default. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]CPallini wrote:
BTW: I really don't know why they think alphabetic sort should be the default.
As opposed to what?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Hi All, I am filling numbers in a listBox. for(int i =;i<20;i++) { CString string; string.Format(i); ListBox.Addstring(string); } the output is like 0 1 10 11 12 .. .. .. .. 19 2 3 4 5 6 7 8 9 Can anypne tell how to get the numbers in order and not like this..
Another approach would be to left-pad the numbers with a
0
. That may go against your design, however."Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
CPallini wrote:
BTW: I really don't know why they think alphabetic sort should be the default.
As opposed to what?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
No sort. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]