Click here to Skip to main content
14,699,089 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using ListBox controls. when i select the multiple values, just i want to store those values in one variables.

But,my code showing all the count values.

I need only selected count values.

what is the problem...?

see my code
Dim PrjType As String
Dim _count As Integer = lstprojtype.Items.Count
If _count <> 0 Then
    For i As Integer = 0 To _count - 1
        PrjType = lstprojtype.Items(i).Value
End If
PrjType = Left(PrjType, Len(PrjType) - 2)
Updated 27-Dec-11 0:53am

1 solution

use this code
Dim a As Integer = 0
Dim str As String = ""
While a < CheckedListBox1.CheckedItems.Count
str = str & CheckedListBox1.CheckedItems(a).ToString
a = a + 1
End While

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900