0
我正在使用checkListbox爲一個進程選擇多個文件。我想知道如何檢查所選文件是否與內容一起存在。讓我知道。提前致謝。如何使用vb.net檢查checklistbox中存在的文件
我的代碼是:
Dim FILE_NAME As String
For j = 0 To chkListBox.Items.Count - 1
If Not chkListBox.Items(j) = "Select/UnselectAll" Then
If chkListBox.GetItemChecked(j) = True Then
FILE_NAME = chkListBox.Items(j)
End If
End If
Next
If System.IO.File.Exists(FILE_NAME) = True Then
Me.Cursor = Cursors.WaitCursor
Timer1.Start()
Else
MessageBox.Show("File Does Not Exist..... Please select any File")
btnFileSelection.Focus()
End If
這裏的條件正常工作時,我選擇沒有文件。但是,如果我選擇列表中的單個文件意味着「文件不存在」消息框顯示,直到循環存在。如何解決它?
http://stackoverflow.com/questions/9537952/check-if-an-item-is-already-exist-in-listbox1 –
@KeertiSystematixInfotech我要檢查checklistbox文件處於選中狀態。如果任何文件檢查意味着我的過程應該運行,否則我想顯示一條消息。謝謝 – MDP
請檢查下面給出的答案。 –