Solved

Save Multiple Check Box Values

Posted on 2006-10-31
6
257 Views
Last Modified: 2010-04-23
I am trying to figure out take any or all of the values in a checkbox list that have been selected, convert them to a string and save them in a database.

I can do the below code, but this only saves (1) value.

txtWorkShedule.text = CheckBoxList1.SelectedItem.ToString

WannaBGeek
0
Comment
Question by:WannaBGeek
6 Comments
 
LVL 8

Expert Comment

by:razo
ID: 17842438
    For i = 0 To CheckedListBox1.CheckedIndices.Count - 1
txtWorkShedule.text +=" " +CheckedListBox1.CheckedIndices.Item(i).tostring
next
0
 
LVL 12

Expert Comment

by:Mamtha1982
ID: 17842512
0
 
LVL 12

Expert Comment

by:Mamtha1982
ID: 17842609
sorry , razo is right.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 12

Accepted Solution

by:
Mamtha1982 earned 500 total points
ID: 17842642
if you want Text from the selection item, you can do

For i = 0 To CheckedListBox1.CheckedItems.Count - 1
txtWorkShedule.Text +=" " +CheckedListBox1.CheckedItems(i)
Next
0
 

Author Comment

by:WannaBGeek
ID: 17842675
Thank you Mamtha!

This is my finished code it works perfectly! :)

Protected Sub CkSchedule_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CkSchedule.SelectedIndexChanged
        Dim strchklist As String = ""
        Dim li As ListItem
        For Each li In CkSchedule.Items
            If li.Selected Then
                strchklist += li.Text + ", "
            End If
        Next
        txtWorkSched.Text = ((strchklist))
0
 
LVL 3

Expert Comment

by:vsvb
ID: 17842719
try this
        Dim itemChecked As Object
        Dim Str As String
        For Each itemChecked In CheckedListBox5.CheckedItems
            Str += "" + itemChecked.ToString
        Next
        MsgBox(Str)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now