Solved

Getting the Value Associated with checked item in a check list box control

Posted on 2014-01-24
2
303 Views
Last Modified: 2014-01-25
I load a check list box with items that have a value with the following code.

Clbx_Elevators.Items.Add(New StringWithValue With {.Text = rec.Fields("Carnumber").Value, .Value = rec.Fields("ElevatorID").Value})

The user can check one or more items

When I need to retrieve the Values associated with each item, I loop through the items, find which one is checked and grab the value using selecteditem.value.  There is no  problem the first time through.  However, when I find another item checked and try to retrieve the "selecteditem.value"  it still gives me the value of the first selected item.  How do I select the next item that is checked so that I can get its value?

Here is my code.

 For I = 0 To (Clbx_Elevators.Items.Count - 1)
            If Clbx_Elevators.GetItemChecked(I) = True Then
                With rec
                    .AddNew()
                    .Fields("jobid").Value = NJID
                    .Fields("ElevatorID").Value = Clbx_Elevators.SelectedItem.value
                    .Update()
                End With
            End If
        Next

Thanks

rws
0
Comment
Question by:BROOKLYN1950
2 Comments
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39808183
Hi BROOKLYN1950;

Is that Brooklyn NY?

Sorry according to Microsoft documentation that CheckedListBox does not support multiple check boxes being checked.

Microsoft Dicumentation
The SelectionMode property determines whether one item in the list box can be selected or no items can be selected. For CheckedListBox objects, multiple selection is not supported. You can set the mode to one item or no items.
0
 

Author Closing Comment

by:BROOKLYN1950
ID: 39808845
Well That settles that.  Thank You Microsoft
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change Format on Data when exporting to Excel 4 33
Help with LINQ and XML 10 36
SQL LINE CONTINUATION ISSUE 12 33
Footer for each row on Gridview 2 21
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

777 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