OpenFileDialog & Array help
I want to use an open file dialog, and be able to select multiple images and have their full path names loaded in an array of an unspecified size... so far I've got to here, but am stuck at how to proceed.
Can someone help?
VB Code:
Private Sub Menu_Open_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Menu_Open.Click
'declares undefined array
Dim Picturelist() As String
Dim fileName As String
Dim i As Integer
ofdPicture.InitialDirectory = "C:\"
ofdPicture.Multiselect = True
ofdPicture.Filter = "Image Files (*.BMP;*.JPG;*.GIF;*.PNG;*.TIFF)|*.BMP;*.JPG;*.GIF;*.PNG;*.TIFF"
ofdPicture.ShowDialog()
I know I'm meant to use ReDim but how would I "count" the number of individual files that have been selected by the user?
Would I have to use a loop to put the path name into the array? Something like
VB Code:
For i = 1 To Picturelist.GetUpperBound(Picturelist)
ReDim Preserve Picturelist(Picturelist.GetUpperBound + 1)
Picturelist(i) = ofdPicture.FileName
Next i