我正在使用一个函数来选择几个文件:
Module OpenFileMod
Public Function OpenFile() As String()
'declare a string, this is will contain the filename that we return
Dim strFileNames As String()
'declare a new open file dialog
Dim fileDialogBox As New OpenFileDialog()
fileDialogBox.Filter = "Excel Files (*.xls)|*.xls"
fileDialogBox.Multiselect = True
'this line tells the file dialog box what folder it should start off in first
'I selected the users my document folder
fileDialogBox.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
'Check to see if the user clicked the open button
If (fileDialogBox.ShowDialog() = DialogResult.OK) Then
strFileNames = fileDialogBox.FileNames
Else
MsgBox("You did not select a file!")
End If
'return the name of the file
Return strFileNames
End Function
End Module
我想知道用户选择了多少文件。
我怎样才能做到这一点?