Click here to Skip to main content
16,005,473 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get Value of Arbitrary ListBox Item Pin
Pete O'Hanlon12-Sep-07 22:39
mvePete O'Hanlon12-Sep-07 22:39 
GeneralSET Value of Arbitrary ListBox Item Pin
Sukhjinder_K12-Sep-07 23:33
Sukhjinder_K12-Sep-07 23:33 
GeneralRe: SET Value of Arbitrary ListBox Item Pin
Pete O'Hanlon12-Sep-07 23:55
mvePete O'Hanlon12-Sep-07 23:55 
GeneralRe: SET Value of Arbitrary ListBox Item Pin
Sukhjinder_K13-Sep-07 0:13
Sukhjinder_K13-Sep-07 0:13 
GeneralRe: SET Value of Arbitrary ListBox Item Pin
Pete O'Hanlon13-Sep-07 0:33
mvePete O'Hanlon13-Sep-07 0:33 
GeneralRe: SET Value of Arbitrary ListBox Item Pin
Sukhjinder_K13-Sep-07 1:59
Sukhjinder_K13-Sep-07 1:59 
AnswerRe: Get Value of Arbitrary ListBox Item Pin
pmarfleet12-Sep-07 22:15
pmarfleet12-Sep-07 22:15 
AnswerRe: Get Value of Arbitrary ListBox Item Pin
Luc Pattyn13-Sep-07 1:19
sitebuilderLuc Pattyn13-Sep-07 1:19 
Hi,

there is a different and better way to achieve a numbered list: ListBox (and ComboBox) support
"OwnerDraw" mode, which means you paint the items yourself in any way you like, instead
of their string value being shown as is. So what you could do is add a DrawItem handler
that does a Graphics.DrawString(itemIndex.ToString()+". "+item.ToString());

Doing this will automatically show the text with its number, whatever happens to the list.
You would have to get the itemIndex from DrawItemEventArgs.Index, and item from
myListBox.Items[itemIndex].

Smile | :)



Luc Pattyn [Forum Guidelines] [My Articles]


this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google


QuestionPlz help me to go to a particular node in xml file Pin
P_Elza12-Sep-07 17:15
P_Elza12-Sep-07 17:15 
AnswerRe: Plz help me to go to a particular node in xml file Pin
Christian Graus12-Sep-07 18:39
protectorChristian Graus12-Sep-07 18:39 
AnswerRe: Plz help me to go to a particular node in xml file Pin
Jintal Patel12-Sep-07 19:15
Jintal Patel12-Sep-07 19:15 
AnswerRe: Plz help me to go to a particular node in xml file Pin
Nouman Bhatti12-Sep-07 19:27
Nouman Bhatti12-Sep-07 19:27 
AnswerRe: Plz help me to go to a particular node in xml file Pin
P_Elza12-Sep-07 21:52
P_Elza12-Sep-07 21:52 
QuestionSaving username and password Pin
C#Coudou12-Sep-07 15:33
C#Coudou12-Sep-07 15:33 
AnswerRe: Saving username and password Pin
Christian Graus12-Sep-07 15:50
protectorChristian Graus12-Sep-07 15:50 
QuestionReading data from a dataset with a checkedlistbox Pin
falles0112-Sep-07 15:28
falles0112-Sep-07 15:28 
AnswerRe: Reading data from a dataset with a checkedlistbox Pin
Christian Graus12-Sep-07 18:52
protectorChristian Graus12-Sep-07 18:52 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
falles0112-Sep-07 19:00
falles0112-Sep-07 19:00 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
Christian Graus13-Sep-07 3:10
protectorChristian Graus13-Sep-07 3:10 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
falles0113-Sep-07 15:12
falles0113-Sep-07 15:12 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
falles0113-Sep-07 15:17
falles0113-Sep-07 15:17 
GeneralRe: Reading data from a dataset with a checkedlistbox Pin
falles0113-Sep-07 15:30
falles0113-Sep-07 15:30 
QuestionDrawing a line to a bitmap Pin
Klazen12-Sep-07 13:31
Klazen12-Sep-07 13:31 
AnswerRe: Drawing a line to a bitmap Pin
Christian Graus12-Sep-07 13:45
protectorChristian Graus12-Sep-07 13:45 
GeneralRe: Drawing a line to a bitmap Pin
Klazen12-Sep-07 14:12
Klazen12-Sep-07 14:12 

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.