Solved

Save Multiple Check Box Values

Posted on 2006-10-31
6
284 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
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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