?
Solved

Save Multiple Check Box Values

Posted on 2006-10-31
6
Medium Priority
?
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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:Praveen Kumar
ID: 17842512
0
 
LVL 12

Expert Comment

by:Praveen Kumar
ID: 17842609
sorry , razo is right.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Accepted Solution

by:
Praveen Kumar earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

752 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