listbox多选问题

    技术2022-05-11  70

    1.listbox控件如何多选取值

      将listbox控件中的selectionmode属性值设置为multiple,listbox控件可以支持多选

     取值问题

       假设控件为listbox1

      Dim i As Integer        Dim str As String        For i = 0 To ListBox1.Items.Count - 1            If ListBox1.Items(i).Selected = True Then                str = str + ListBox1.Items(i).Value + ","            End If        Next        label1.Text = Left(str, Len(str) - 1)

    2.ListBox中的MultiSelect设置为True了,使用是要按住CTRL_点或者按左键拖才能多选择,我想做成这样:鼠标点哪一个把点的这个增加到选择中,如果点的是已经选择的项目则取消这个选择.请问怎么实现?

    ExtendedSeelct=True就可以实现了哦.

     

    最新回复(0)