假设我有OpenFileDialog
且MultiSelect
属性为 true ,以下是需要执行的操作列表。
谢谢:)
答案 0 :(得分:1)
Dim numSelected = openFileDialog1.FileNames.Length
Dim message As String
Dim maxNumber = 5
Dim missing As Int32 = maxNumber - numSelected
If missing > 0 Then
message = String.Format("You still need {0} items.", missing)
MessageBox.Show(message)
ElseIf missing < 0 Then
message = String.Format("Maximum number of selected items is {0}.", maxNumber)
MessageBox.Show(message)
Else
' valid ... '
End If