Solved

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

Posted on 2014-01-24
2
299 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
Comment Utility
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
Comment Utility
Well That settles that.  Thank You Microsoft
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now