well, have you got a line imgBanner.DataBind();
after imgBanner.DataSource = fileInfos; ?
or just omitted it in the question?
"COHENMARVIN" wrote:
> I am trying to display the contents of a directory in a listbox. I
> manage to get an array of fileInfo objects, and when I print them out
> they indeed contain several file names. But when I do
> 'imgBanner.DataSource = fileInfos', I'm left with an empty listbox.
> Here is the code:
> =========================
> Dim fileInfos() as FileInfo
> Dim fi as FileInfo
>
> myDir = New DirectoryInfo(MapPath("/vwSpecials"))
> fileInfos = myDir.GetFiles()
>
> For Each fi In fileInfos
> strFiles = strFiles & "," & fi.Name
> Next
> LabDiagnostic.Text = strFiles
> imgBanner.DataSource = fileInfos
> ===============================
> The actual control is:
> <ASP:Listbox id="imgBanner" runat="server" Rows="1" />
>
> Any help is appreciated.
> -- Marvin
>
>
|