Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 26th, 2004, 08:50 PM
M3L M3L is offline
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CheckedListBox control and Database

Dear All,

anyone could pls help me with CheckedListBox control on a window form... i've been in many forums but no-one has answered my problem:(.

I have two tables: Person table (PersonID, Name, InterestID(FK)), and Interest table (InterestID, Interest).

I had displayed all vallues from the Interest column in Interest table in a CheckedListBox, using array and Select SqlCommand. Now, my problem is, how could I record any boxes checked by the user to choose the interests of a person?

Then, how could I have checkboxes checked/unchecked depending on the values of InterestID of a person in its table when showing a person's details (pre-selecting the check-boxes), then be able to do any changes/updates to its interests by checking/uncheking boxes, then record those changes to the particular person table.

THANKS so much^^.


 
Old May 26th, 2004, 11:50 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Never mind others dear friend: u'll always get ur answer in P2P.WROX

to get checked/Unchecked items in checkedListBox use:

Code:
for(int i=1; i<checkedListBox.Items.Count+1; i++)
{
    if( this.checkedListBox.GetItemChecked(i-1))
        //Check operation
    else
        //UnCheck operation
}//for
Always:),
Hovik Melkomian.





Similar Threads
Thread Thread Starter Forum Replies Last Post
checkedListBox to a listbox? silasla C# 4 May 2nd, 2008 04:31 AM
get current checkedlistbox value zachatcoza C# 0 June 8th, 2007 08:42 AM
HOW TO MSCHART WHEN USING DATABASE CONTROL. dextergaisie Pro VB 6 1 May 14th, 2007 01:56 PM
make checkedListBox readonly melvik C# 0 September 14th, 2003 09:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.