G
Guest
I was wondering if someone could help me with my problem. I have some code
that gets document names from a directory; I'm trying to make each document
name into a linklabel. I got the name of the first document to show but each
additional document is not showing.
Dim strDirectory = ConfigurationSettings.AppSettings("cad_directory")
Dim strFile As String
Dim i As Integer = 0
For Each strFile In Directory.GetFiles(strDirectory) 'get the files
in the directory
If Path.GetExtension(strFile).ToLower = ".doc" Or
Path.GetExtension(strFile).ToLower = ".pdf" Then
Dim strTemp As String = Path.GetFileName(strFile)
Dim lnkLabel(i) As LinkLabel
lnkLabel(i) = New System.Windows.Forms.LinkLabel
With lnkLabel(i)
.Name = "lnkLabel_" & (i)
.Text = strTemp
End With
Me.lbdocs.Controls.Add(lnkLabel(i))
End If
i += 1
Next
What am I doing wrong?
that gets document names from a directory; I'm trying to make each document
name into a linklabel. I got the name of the first document to show but each
additional document is not showing.
Dim strDirectory = ConfigurationSettings.AppSettings("cad_directory")
Dim strFile As String
Dim i As Integer = 0
For Each strFile In Directory.GetFiles(strDirectory) 'get the files
in the directory
If Path.GetExtension(strFile).ToLower = ".doc" Or
Path.GetExtension(strFile).ToLower = ".pdf" Then
Dim strTemp As String = Path.GetFileName(strFile)
Dim lnkLabel(i) As LinkLabel
lnkLabel(i) = New System.Windows.Forms.LinkLabel
With lnkLabel(i)
.Name = "lnkLabel_" & (i)
.Text = strTemp
End With
Me.lbdocs.Controls.Add(lnkLabel(i))
End If
i += 1
Next
What am I doing wrong?