Click here to Skip to main content
15,912,069 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: [VB10] Check which ListBox items are selected and which are not Pin
Eddy Vluggen3-Aug-10 10:51
professionalEddy Vluggen3-Aug-10 10:51 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
The Mighty Atom3-Aug-10 11:53
The Mighty Atom3-Aug-10 11:53 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
Luc Pattyn3-Aug-10 12:31
sitebuilderLuc Pattyn3-Aug-10 12:31 
GeneralRe: [VB10] Check which ListBox items are selected and which are not [modified] Pin
The Mighty Atom3-Aug-10 13:01
The Mighty Atom3-Aug-10 13:01 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
The Mighty Atom4-Aug-10 7:14
The Mighty Atom4-Aug-10 7:14 
AnswerRe: [VB10] Check which ListBox items are selected and which are not Pin
Luc Pattyn4-Aug-10 8:12
sitebuilderLuc Pattyn4-Aug-10 8:12 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
The Mighty Atom4-Aug-10 8:46
The Mighty Atom4-Aug-10 8:46 
AnswerRe: [VB10] Check which ListBox items are selected and which are not Pin
Luc Pattyn4-Aug-10 9:25
sitebuilderLuc Pattyn4-Aug-10 9:25 
Hi,

sorry I didn't know this, it seems one cannot iterate both Items and SelectedItems like that at the same time.

I did come up with this code, which works fine:

Private Sub ListBox1_SelectedValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedValueChanged
    Dim s As String = ""
    For i As Integer = 0 To ListBox1.Items.Count - 1
        Dim item As String = ListBox1.Items(i)
        If ListBox1.SelectedItems.Contains(item) Then
            s = s & " +" & item
        Else
            s = s & " -" & item
        End If
    Next
    Label1.Text = s
End Sub


Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
The Mighty Atom4-Aug-10 9:45
The Mighty Atom4-Aug-10 9:45 
GeneralRe: [VB10] Check which ListBox items are selected and which are not Pin
Luc Pattyn4-Aug-10 11:42
sitebuilderLuc Pattyn4-Aug-10 11:42 
QuestionInput data set changed dynamically according to option selection in VB.net 2005 Pin
Andraw Tang2-Aug-10 12:03
Andraw Tang2-Aug-10 12:03 
AnswerRe: Input data set changed dynamically according to option selection in VB.net 2005 Pin
Eddy Vluggen3-Aug-10 10:55
professionalEddy Vluggen3-Aug-10 10:55 
GeneralRe: Input data set changed dynamically according to option selection in VB.net 2005 Pin
Andraw Tang4-Aug-10 3:49
Andraw Tang4-Aug-10 3:49 
GeneralRe: Input data set changed dynamically according to option selection in VB.net 2005 Pin
Eddy Vluggen4-Aug-10 4:21
professionalEddy Vluggen4-Aug-10 4:21 
GeneralRe: Input data set changed dynamically according to option selection in VB.net 2005 Pin
Andraw Tang4-Aug-10 4:39
Andraw Tang4-Aug-10 4:39 
Questiondata access sample project Pin
soulrebelpd2-Aug-10 11:05
soulrebelpd2-Aug-10 11:05 
AnswerRe: data access sample project Pin
Yusuf2-Aug-10 12:48
Yusuf2-Aug-10 12:48 
GeneralRe: data access sample project Pin
soulrebelpd2-Aug-10 13:50
soulrebelpd2-Aug-10 13:50 
GeneralRe: data access sample project Pin
Yusuf2-Aug-10 14:39
Yusuf2-Aug-10 14:39 
AnswerRe: data access sample project Pin
Simon_Whale3-Aug-10 0:08
Simon_Whale3-Aug-10 0:08 
GeneralRe: data access sample project Pin
soulrebelpd3-Aug-10 6:58
soulrebelpd3-Aug-10 6:58 
QuestionDLL Registration Pin
jayachandra.c2-Aug-10 2:46
jayachandra.c2-Aug-10 2:46 
AnswerRe: DLL Registration Pin
Dave Kreskowiak2-Aug-10 5:11
mveDave Kreskowiak2-Aug-10 5:11 
AnswerRe: DLL Registration Pin
Thomas Krojer3-Aug-10 21:37
Thomas Krojer3-Aug-10 21:37 
Questionregister VB.NET COM dll - regsvr32.exe Pin
devvvy29-Jul-10 22:39
devvvy29-Jul-10 22:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.