Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-01-24
2
Medium Priority
?
313 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 64

Accepted Solution

by:
Fernando Soto earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

926 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