Solved

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

Posted on 2014-01-24
2
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

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 …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

630 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