473,394 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help Understanding CheckedListBox

Hello and thank you for taking the time to look.

I Have a form that asks for options. I need the user to click any of the
options listed. I'd like to use the CheckedListBox for this but I need to
know how it works.

I have the options in a table in a database. I would like to have the
datasource of the CheckedListBox be a datareader that has 2 columns. One
column is the Primary Key and the other is the text of the option.

I'd like to save the Primary Key when the user click the options and then a
Save button. I don't need the text.

How can I set the Item and the Value in the CheckedListBox?
How can I retrieve all the values that were checked?

The books I have don't go into this kind of detail and help is helpless.

Thank you for taking your time to help
Ron.
Nov 21 '05 #1
1 1507
You can just use the indexer and check the Selected Property to determine if
it's been checked or not - done in a loop you can get all of the values -

if (checkboxlist1.Items[i].Selected)
{//Do Whatverr }
http://msdn.microsoft.com/library/de...classtopic.asp
-

You can set it the reverse way - just use the indexer and set the Selected
Property to true
--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"Capt_Ron" <Ca*****@discussions.microsoft.com> wrote in message
news:B4**********************************@microsof t.com...
Hello and thank you for taking the time to look.

I Have a form that asks for options. I need the user to click any of the
options listed. I'd like to use the CheckedListBox for this but I need to
know how it works.

I have the options in a table in a database. I would like to have the
datasource of the CheckedListBox be a datareader that has 2 columns. One
column is the Primary Key and the other is the text of the option.

I'd like to save the Primary Key when the user click the options and then a Save button. I don't need the text.

How can I set the Item and the Value in the CheckedListBox?
How can I retrieve all the values that were checked?

The books I have don't go into this kind of detail and help is helpless.

Thank you for taking your time to help
Ron.

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Reza | last post by:
Hi, I want to check one of the memebrs of a checkedListbox based on its value. I 'm getting a number(say 1355) from another control and based on that number I want to check an item which its...
1
by: xiuyu_0129 | last post by:
Hi All, How do I store a string value for an item in a CheckedListBox in Windows Form? For a web based application, CheckBoxList allowed us to store 2 string values for the item in it. How do...
3
by: Steve Cutting | last post by:
Hi all, I have a CheckedListBox on one pane of a TabControl on a form. I find that whenever the user clicks a different tab then comes back, any checks that were in the list have disappeared. ...
2
by: Manuel Canas | last post by:
Hi there, I'm having this dilema with a checkedlistbox. I have an array of items in there, what I want to accomplish is the following; The user could check all the items in the...
3
by: Jerry Spence1 | last post by:
I am trying to capture when an item in the CheckedListBox occurs. I am using the event: CheckedListBox1_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs)...
0
by: Terry Olsen | last post by:
Dim dirs() as string = Directory.GetDirectories(MyPath) CheckedListBox.DataSource = dirs CheckedListBox.Update For I as Integer = 0 To CheckedListBox.Items.Count - 1...
1
by: Huahe | last post by:
Hi, I have an checkedlistbox with a lot of items, so there is a vertical scrollbar in the checkedlistbox. I want to make the checkedlistbox invisible when the mouseleave event goes off. The...
3
by: BostonNole | last post by:
Does anyone know how to get the checkedlistbox to display items horizontally on a windows form? It seems that it only displays its check box items vertically (up and down), which is not what I...
6
by: Steve Teeples | last post by:
Can someone show me an example of how to place a "CheckedListBox" property within a PropertyGrid? -- ----------- Thanks, Steve
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.