Vincent
Posts: 31
|
Posted: 03/26/2012, 12:22 AM |
|
Use the control's BeforeShow Event and add some custom code. Here's what I did to show an icon as the filetype
Function tasks_Label_Attachment_BeforeShow(Sender) 'tasks_Label_Attachment_BeforeShow @9726-78516DC3
'Get Original Filename @9754-7858E0C6
Dim nPos, FileName
nomdufichier = tasks.Label_Attachment.Value
FileName = tasks.Label_Attachment.Value
nPos = InStr(FileName,".")
If nPos > 0 Then
FileName = Mid(FileName,nPos+1)
tasks.Label_Attachment.Value = FileName
End If
'End Get Original Filename
'Custom Code @9757-73254650
' -------------------------
Dim nomdufichier
If Right(tasks.Label_Attachment.Value,3) = "jpg" then
tasks.Label_Attachment.Value = "<a href=""uploadedfiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/JPG.png"" height=""32"" width=""32"" alt=""" & FileName &""" /></a>"
elseif Right(tasks.Label_Attachment.Value,3) = "png" then
tasks.Label_Attachment.Value = "<a href=""UploadedFiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/PNG.png"" height=""32"" width=""32"" alt=""" & FileName & """ /></a>"
elseif Right(tasks.Label_Attachment.Value,3) = "zip" then
tasks.Label_Attachment.Value = "<a href=""UploadedFiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/ZIP.png"" height=""32"" width=""32"" alt=""" & FileName & """ />"
elseif Right(tasks.Label_Attachment.Value,3) = "xls" then
tasks.Label_Attachment.Value = "<a href=""UploadedFiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/XLS.png"" height=""32"" width=""32"" alt=""" & FileName & """ />"
elseif Right(tasks.Label_Attachment.Value,3) = "doc" then
tasks.Label_Attachment.Value = "<a href=""UploadedFiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/DOC.png"" height=""32"" width=""32"" alt=""" & FileName & """ />"
elseif Right(tasks.Label_Attachment.Value,4) = "xlsx" then
tasks.Label_Attachment.Value = "<a href=""UploadedFiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/XLSX.png"" height=""32"" width=""32"" alt=""" & FileName & """ />"
elseif Right(tasks.Label_Attachment.Value,4) = "docx" then
tasks.Label_Attachment.Value = "<a href=""UploadedFiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/DOCX.png"" height=""32"" width=""32"" alt=""" & FileName & """ />"
elseif Right(tasks.Label_Attachment.Value,3) = "mp3" then
tasks.Label_Attachment.Value = "<a href=""UploadedFiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/MP3.png"" height=""32"" width=""32"" alt=""" & FileName & """ />"
elseif Right(tasks.Label_Attachment.Value,3) = "pdf" then
tasks.Label_Attachment.Value = "<a href=""UploadedFiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/PDF.png"" height=""32"" width=""32"" alt=""" & FileName & """ />"
elseif Right(tasks.Label_Attachment.Value,3) = "txt" then
tasks.Label_Attachment.Value = "<a href=""UploadedFiles/"& nomdufichier &""" title=""Please click to download " & FileName & """><img style=""vertical-align:middle;"" src=""images/Icons/TXT.png"" height=""32"" width=""32"" alt=""" & FileName & """ />"
End If
' -------------------------
'End Custom Code
End Function 'Close tasks_Label_Attachment_BeforeShow @9726-54C34B28
|