G
GGill
In my form i have 2 list boxes and command button 'cmdAdd'. when I select
from list box 'lstAvailable' and click on button then it will add to second
list box 'lstSelected'., so my code for button add on click works fine. I am
trying to find out how can i remove when i double click on second list box
'lstSelected' (the row source type for that list box is Value List, control
source nothing).
Please help me !!!!
Thank you.
=======
Private Sub cmdAdd_Click()
Dim InvListCounter As Integer, InvCurrentCounter As Integer
Dim InvListItems As Integer, InvCurrentItems As Integer
Dim ListStr As String, FoundInList As Integer
InvListItems = [lstAvailable].ListCount - 1
InvCurrentItems = [lstSelected].ListCount - 1
For InvListCounter = 0 To InvListItems
If [lstAvailable].Selected(InvListCounter) = True Then
If IsNull([lstSelected].RowSource) Then
ListStr = [lstAvailable].Column(0, InvListCounter) & ";"
[lstSelected].RowSource = ListStr
Else
FoundInList = False
For InvCurrentCounter = 0 To InvCurrentItems
If [lstSelected].Column(0, InvCurrentCounter) = _
[lstAvailable].Column(0, InvListCounter) Then
FoundInList = True
End If
Next InvCurrentCounter
If Not FoundInList Then
ListStr = [lstSelected].RowSource & _
[lstAvailable].Column(0, InvListCounter) & ";"
[lstSelected].RowSource = ""
[lstSelected].RowSource = ListStr
End If
End If
End If
Next InvListCounter
End Sub
==========
from list box 'lstAvailable' and click on button then it will add to second
list box 'lstSelected'., so my code for button add on click works fine. I am
trying to find out how can i remove when i double click on second list box
'lstSelected' (the row source type for that list box is Value List, control
source nothing).
Please help me !!!!
Thank you.
=======
Private Sub cmdAdd_Click()
Dim InvListCounter As Integer, InvCurrentCounter As Integer
Dim InvListItems As Integer, InvCurrentItems As Integer
Dim ListStr As String, FoundInList As Integer
InvListItems = [lstAvailable].ListCount - 1
InvCurrentItems = [lstSelected].ListCount - 1
For InvListCounter = 0 To InvListItems
If [lstAvailable].Selected(InvListCounter) = True Then
If IsNull([lstSelected].RowSource) Then
ListStr = [lstAvailable].Column(0, InvListCounter) & ";"
[lstSelected].RowSource = ListStr
Else
FoundInList = False
For InvCurrentCounter = 0 To InvCurrentItems
If [lstSelected].Column(0, InvCurrentCounter) = _
[lstAvailable].Column(0, InvListCounter) Then
FoundInList = True
End If
Next InvCurrentCounter
If Not FoundInList Then
ListStr = [lstSelected].RowSource & _
[lstAvailable].Column(0, InvListCounter) & ";"
[lstSelected].RowSource = ""
[lstSelected].RowSource = ListStr
End If
End If
End If
Next InvListCounter
End Sub
==========