|
-
Dec 8th, 2004, 03:05 PM
#1
Thread Starter
Frenzied Member
Help with retrieving text from a Check List Box -> Resolved
I am using a checked list box but for some reason I can not ficure out how to retrieve the text from a specific index...
I tried this
clbModels.GetItemText(1)
but all I get is the index back... Any ideas?
Last edited by RudyL; Dec 8th, 2004 at 03:17 PM.
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Dec 8th, 2004, 03:09 PM
#2
Re: Help with retrieving text from a Check List Box
try
Code:
CheckedListBox1.Items(x).ToString()
x being the index
-
Dec 8th, 2004, 03:16 PM
#3
Thread Starter
Frenzied Member
Re: Help with retrieving text from a Check List Box
 Originally Posted by kleinma
try
Code:
CheckedListBox1.Items(x).ToString()
x being the index
Thanks.. That works beautifuly.. 
So what exaclt is "GetItemText" for? According to the object browser it should do the same thing..
"Summary:
Returns the text representation of the specified item.
Parameters:
item: The object from which to get the contents to display. "
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Dec 8th, 2004, 03:24 PM
#4
Re: Help with retrieving text from a Check List Box -> Resolved
object browser = poo
msdn = yay
basically it does the same exact thing... BUT if you look at the help file on MSDN, the param you pass to the GetItemText method is not the index... its the object itself...
item
The object from which to get the contents to display.
so it makes sense that you pass the object "1" to it, that it spits it right back at you, because its simply calling ToString on "1", which gives you.. well.. "1"
so if you have the OBJECT in question (since listboxes can hold objects, not just text, but can only display the ToString of the objects they hold) using the method I gave is simply the easiest way to go about it
-
Dec 8th, 2004, 03:26 PM
#5
Thread Starter
Frenzied Member
Re: Help with retrieving text from a Check List Box -> Resolved
Sounds good to me.. 
Thanks again,
Rudy
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|