Solved

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

Posted on 2014-01-24
2
304 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 63

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 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