G
Guest
I have a problem I was hoping someone can help me with. My first problem is
moving a link label that is created at runtime to the of an arraylist on the
next line in the listbox. Currently, the Close link is showing up on the
first line and covering up the file names when the box is populated. Here is
the code:
Dim docArray As New ArrayList() 'create an arraylist to hld the documents.
Dim strDirectory = ConfigurationSettings.AppSettings("cad_directory")
Dim objLinkClose As New System.Windows.Forms.LinkLabel 'create new linklabel
With objLinkClose
.Name = "lnkClose"
.Text = "Close"
End With
Dim strFile As String
For Each strFile In Directory.GetFiles(strDirectory) 'get the files
in the directory
If Path.GetExtension(strFile) = ".doc" Or
Path.GetExtension(strFile) = ".pdf" Then
Dim strTemp As String = Path.GetFileName(strFile)
docArray.Add(strTemp)
End If
Next
'If no files are found then inform the user through the listbox.
If docArray.Count() = 0 Then
Dim strTmp As String = "No Files to Display.......!"
docArray.Add(strTmp)
End If
lbdocs.DataSource = docArray
Me.lbdocs.Controls.Add(objLinkClose)
Secondly, I need to make the file names that are returned linklabels also;
so that when a user clicks on one it opens up the file in WORD or PDF(that's
the plan so far). So, any help would greatly be appreciated.
moving a link label that is created at runtime to the of an arraylist on the
next line in the listbox. Currently, the Close link is showing up on the
first line and covering up the file names when the box is populated. Here is
the code:
Dim docArray As New ArrayList() 'create an arraylist to hld the documents.
Dim strDirectory = ConfigurationSettings.AppSettings("cad_directory")
Dim objLinkClose As New System.Windows.Forms.LinkLabel 'create new linklabel
With objLinkClose
.Name = "lnkClose"
.Text = "Close"
End With
Dim strFile As String
For Each strFile In Directory.GetFiles(strDirectory) 'get the files
in the directory
If Path.GetExtension(strFile) = ".doc" Or
Path.GetExtension(strFile) = ".pdf" Then
Dim strTemp As String = Path.GetFileName(strFile)
docArray.Add(strTemp)
End If
Next
'If no files are found then inform the user through the listbox.
If docArray.Count() = 0 Then
Dim strTmp As String = "No Files to Display.......!"
docArray.Add(strTmp)
End If
lbdocs.DataSource = docArray
Me.lbdocs.Controls.Add(objLinkClose)
Secondly, I need to make the file names that are returned linklabels also;
so that when a user clicks on one it opens up the file in WORD or PDF(that's
the plan so far). So, any help would greatly be appreciated.