G
Guest
My code returns the list of files in the directory I desire, but it displays
the entire path to the file and the file name. I can msgbox the desired
result (just the file name), but I believe the readonlycollection has
something to do with this...
Dim numofchars As Integer = (memberpath & "\" &
Me.EmpMemberNoTextBox.Text).ToString.Length + 1
Dim filelist As
System.Collections.ObjectModel.ReadOnlyCollection(Of String)
filelist = My.Computer.FileSystem.GetFiles(memberpath & "\"
& Me.EmpMemberNoTextBox.Text, FileIO.SearchOption.SearchTopLevelOnly)
For Each foundfile As String In filelist
Dim lengthofpath As Integer = (foundfile).Length.ToString
Dim filenamelength As Integer = lengthofpath - numofchars
Dim filename As String =
Microsoft.VisualBasic.Right(foundfile, filenamelength)
Me.ComboBxMemberFiles.Items.Add(filename.ToString)
Next
How can I display just the filename in the combo box?
Thank you!
the entire path to the file and the file name. I can msgbox the desired
result (just the file name), but I believe the readonlycollection has
something to do with this...
Dim numofchars As Integer = (memberpath & "\" &
Me.EmpMemberNoTextBox.Text).ToString.Length + 1
Dim filelist As
System.Collections.ObjectModel.ReadOnlyCollection(Of String)
filelist = My.Computer.FileSystem.GetFiles(memberpath & "\"
& Me.EmpMemberNoTextBox.Text, FileIO.SearchOption.SearchTopLevelOnly)
For Each foundfile As String In filelist
Dim lengthofpath As Integer = (foundfile).Length.ToString
Dim filenamelength As Integer = lengthofpath - numofchars
Dim filename As String =
Microsoft.VisualBasic.Right(foundfile, filenamelength)
Me.ComboBxMemberFiles.Items.Add(filename.ToString)
Next
How can I display just the filename in the combo box?
Thank you!