473,396 Members | 2,082 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,396 software developers and data experts.

getting the selected items of a checklistbox into a tring array

4
i have a check list box. i am displaying the course names in that. user can check the courses they want to follow. they are allowed to select maximum of three courses. how can i get the checked course names into a string variable array.

i am planning to update my database by using those string array variables.

plzzz plzzzzzzz help me o this
Dec 30 '08 #1
2 3314
Frinavale
9,735 Expert Mod 8TB
You want to use implement code that handles the CheckedListBox's ItemCheck event. Here you can check how many courses the user has selected:

Expand|Select|Wrap|Line Numbers
  1. Private Sub checkedListBox1_ItemCheck(sender As Object, _
  2.   e As ItemCheckEventArgs) Handles checkedListBox1.ItemCheck
  3.  
  4.   If e.NewValue = CheckState.Unchecked Then
  5.     If checkedListBox1.CheckedItems.Count < 3 Then
  6.       checkedListBox1.Enabled = True
  7.     Else
  8.       checkedListBox1.Enabled = False
  9.      End If
  10.    Else
  11.      button2.Enabled = True
  12.    End If
  13. End Sub 'checkedListBox1_ItemCheck
  14.  
You can determine which items were selected using the CheckedListBox's CheckedItems property:

Expand|Select|Wrap|Line Numbers
  1. For i = 0 To checkedListBox1.CheckedItems.Count - 1
  2.    'insert code that builds string here.
  3. Next 
  4.  
For more information on the CheckedListBox please see what MSDN has on the topic.

-Frinny
Dec 31 '08 #2
Xennex
7
Hmm.. Seems that the checked listbox is locked from editing once 3 items have been checked.. I guess if you use that code you may need something like a "clear selections" button to unlock it should changes need to be made in the selection. (^_^)
Jan 21 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: harry | last post by:
Just want to traverse a listbox's (multi select) items & for those that are selected extract the displayed text - something like below - function getSelectedDescrs(lst) { var buf; var maxItems...
3
by: luisg | last post by:
I am having some difficulty getting a checkboxlist control to determine which checkboxes are checked. Here is a code sample from the event that should read it: private void...
4
by: Merdaad | last post by:
My drop down list is populated from a static array in my codebehind (c#) code. I set the selected index based on some known values(from DB), when the screen shows up, dropdown list shows that the...
4
by: Neil | last post by:
I have a gridview which is being populated with no problems. I want to be able to reference the data from the cells in the row but having followed an example on MSDN cannot get any data to be...
2
by: Mike Kim | last post by:
hi all, i have a checklistbox populated with about 50 items from database. and on the same form, i added to button to do the following. if you click this button, i want to have all items in the...
0
by: Brian Henry | last post by:
Since no one else knew how to do this I sat here all morning experimenting with this and this is what I came up with... Its an example of how to get a list of items back from a virtual mode list...
4
by: bushi | last post by:
hi ! i have following code to display some text on a web form,after getting it from database. <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate>...
0
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
Hi (asp.net 2.0, vb.net, SQL Server 2005 Express) I have a Form where users can select multiple preferences via a CheckListBox. Those items are stored in a SQL 2005 database and are related to...
3
by: khalidjan9 | last post by:
I have data in an arraylist and i want to add data to checklist box on runtime and i also want to display a textbox besides it so that i get the comments example : checklistbox "text" textbox...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.