Display images from directory

I need to display images from the directory. I use datalist and it shows images but it also shows link -Thumbs.db on the page. When I click the link -there is nothing. I do not have this db in my directory. How can I get rid of this Thumbs.db link on the page?
Please, advise

My apsx form:
 <asp:DataList ID="dtlist" runat="server" RepeatColumns="3" CellPadding="5">
<ItemTemplate>
<asp:Image Width="100" ID="Image1" ImageUrl='<%# Bind("Name", "~/Images1/{0}") %>' runat="server" />
<br />
<asp:HyperLink ID="HyperLink1" Text='<%# Bind("Name") %>' NavigateUrl='<%# Bind("Name", "~/Images1/{0}") %>' runat="server"/>
</ItemTemplate>
<ItemStyle BorderColor="Brown" BorderStyle="dotted" BorderWidth="3px" HorizontalAlign="Center"
VerticalAlign="Bottom" />
</asp:DataList>

My code:

Public Sub BindDataList()


        Dim dir As New DirectoryInfo(MapPath("Images1"))
        Dim files As Array = dir.GetFiles()
        Dim ListItems As New ArrayList
        For Each FileInfo In files
           ListItems.Add(FileInfo)
        Next
       dtlist.DataSource = ListItems
        dtlist.DataBind()

   End Sub
msoutAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Robert SchuttSoftware EngineerCommented:
It's a hidden file created by windows when someone is looking at your server directory directly in thumbnail mode (maybe yourself).

One thing you could do is leave all hidden files out of your list, for example:
        For Each FileInfo As FileInfo In files
            If (FileInfo.Attributes And FileAttributes.Hidden) = 0 Then
                ListItems.Add(FileInfo)
            End If
        Next

Open in new window

but if it's really just the Thumbs.db you want to eliminate try this instead:
        For Each FileInfo As FileInfo In files
            If Not FileInfo.Name.Equals("thumbs.db", StringComparison.OrdinalIgnoreCase) Then
                ListItems.Add(FileInfo)
            End If
        Next

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.