在ListBox选定的值中得到错误的计数. [英] Getting wrong count in ListBox selected values.

查看:72
本文介绍了在ListBox选定的值中得到错误的计数.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用ListBox控件.当我选择多个值时,我只想将这些值存储在一个变量中.

但是,我的代码显示了所有计数值.

我只需要选择计数值.

有什么问题...?

看到我的代码
------------

Hi,
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
    Next
End If
PrjType = Left(PrjType, Len(PrjType) - 2)

推荐答案

使用此代码
昏暗的整数= 0
Dim str As String ="
虽然< CheckedListBox1.CheckedItems.Count
str = str& CheckedListBox1.CheckedItems(a).ToString
a = a + 1
结束时
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


这篇关于在ListBox选定的值中得到错误的计数.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆