Colleagues,
Say, you have a form with a ListBox with SelectionMode set to Multi-select, that is to provide one of the parameters for some process. The User marks one or more items in this ListBox and hits the "Go/Run/Execute" button. And the Program now has to pick the selected items, one by one, and "feed" them into the processing procedure.
In another programming language it would be something like
My problem is - I can't find this Selected property or some equivalent to it in VS documentation.
Could you, please, enlighten me on this matter?
TIA!
Regards,
Ilya
P.S. Resolved:
Say, you have a form with a ListBox with SelectionMode set to Multi-select, that is to provide one of the parameters for some process. The User marks one or more items in this ListBox and hits the "Go/Run/Execute" button. And the Program now has to pick the selected items, one by one, and "feed" them into the processing procedure.
In another programming language it would be something like
Code:
LOCAL lnCount As Integer, llRet As Boolean, llGoOn As Boolean
llGoOn = .T.
For lnCount = 0 To lstCriteria.ItemsCount
If lstCriteria.Items(lnCount).Selected
llRet = RunSomeProcess(lstCriteria.Items(1).Value)
If !llRet
MessageBox("Process failed")
llGoOn = .F.
Exit
EndIf
EndIf
Next lnCount
Could you, please, enlighten me on this matter?
TIA!
Regards,
Ilya
P.S. Resolved:
Code:
Dim loSelItems = lstExtensions.SelectedItems, lcExt As String = "", lsFilePath As String = AddBackSlash(txtSrcDir.Text.Trim()), liCnt As Int16 = 0
' Check if the User filled this entry at all
If txtSrcDir.Text.Trim() = "" Then
MsgBox("The entry box for Search Dir cannot be blank!", MsgBoxStyle.Critical, Me.Text & ": Invalid User's entry!")
cmdSrcDir.Focus()
Return lnCnt
End If
For Each lcItem In loSelItems
lcExt = lcItem.ToString()
If File.Exists(lsFilePath & lcExt) Then lnCnt = lnCnt + 1
Next
Return lnCnt