From: David C on
I would like to sort the list of files (documents) that I am retrieving into
a DataGrid control when they are first displayed. Currently they just list
in the order that they appear in the directory and I would like to sort them
on LastWriteTime property. Below is what I am using to populate the
DataGrid. Thanks.

David


Dim dirInfo As New DirectoryInfo(strPathPhy)
articleList.DataSource = dirInfo.GetFiles()
articleList.DataBind()



From: sloan on

http://morewally.com/cs/blogs/wallym/archive/2007/08/10/visual-studio-2008-friday-august-10-2007.aspx

Looks like you need to specify the version of the framework if url doesn't
meet your need.





"David C" <dlchase(a)lifetimeinc.com> wrote in message
news:Og3YzWG3IHA.4484(a)TK2MSFTNGP02.phx.gbl...
>I would like to sort the list of files (documents) that I am retrieving
>into a DataGrid control when they are first displayed. Currently they just
>list in the order that they appear in the directory and I would like to
>sort them on LastWriteTime property. Below is what I am using to populate
>the DataGrid. Thanks.
>
> David
>
>
> Dim dirInfo As New DirectoryInfo(strPathPhy)
> articleList.DataSource = dirInfo.GetFiles()
> articleList.DataBind()
>
>
>


From: David C on
I am running on VS 2005 and .Net 2.0

David
"sloan" <sloan(a)ipass.net> wrote in message
news:OBmFbkG3IHA.4272(a)TK2MSFTNGP03.phx.gbl...
>
> http://morewally.com/cs/blogs/wallym/archive/2007/08/10/visual-studio-2008-friday-august-10-2007.aspx
>
> Looks like you need to specify the version of the framework if url doesn't
> meet your need.
>
>
>
>
>
> "David C" <dlchase(a)lifetimeinc.com> wrote in message
> news:Og3YzWG3IHA.4484(a)TK2MSFTNGP02.phx.gbl...
>>I would like to sort the list of files (documents) that I am retrieving
>>into a DataGrid control when they are first displayed. Currently they
>>just list in the order that they appear in the directory and I would like
>>to sort them on LastWriteTime property. Below is what I am using to
>>populate the DataGrid. Thanks.
>>
>> David
>>
>>
>> Dim dirInfo As New DirectoryInfo(strPathPhy)
>> articleList.DataSource = dirInfo.GetFiles()
>> articleList.DataBind()
>>
>>
>>
>
>


From: siccolo on
On Jul 2, 1:03 pm, "David C" <dlch...(a)lifetimeinc.com> wrote:
> I would like to sort the list of files (documents) that I am retrieving into
> a DataGrid control when they are first displayed.  Currently they just list
> in the order that they appear in the directory and I would like to sort them
> on LastWriteTime property.  Below is what I am using to populate the
> DataGrid.  Thanks.
>
> David
>
>     Dim dirInfo As New DirectoryInfo(strPathPhy)
>     articleList.DataSource = dirInfo.GetFiles()
>     articleList.DataBind()

something like this, perhaps: (see at
http://www.siccolo.com/Articles/CodeProject/SelectFileDlg_SmartPhone/Smartphone_WM6_FileDialog.html)
...
Dim FileInfoComparer As FileInfoComparer = New FileInfoComparer()
Dim FileList() As FileInfo = ParentFolder.GetFiles()
Array.Sort(FileList, FileInfoComparer)
...
where
Public Class FileInfoComparer Implements
System.Collections.IComparer
Public Function Compare(ByVal objFileInfo1 As Object, ByVal
objFileInfo2 As Object) As Integer _
Implements IComparer.Compare
Dim FileInfo1 As System.IO.FileInfo = CType(objFileInfo1,
System.IO.FileInfo)
Dim FileInfo2 As System.IO.FileInfo = CType(objFileInfo2,
System.IO.FileInfo)

Return String.Compare(FileInfo1.Name, FileInfo2.Name, True)
End Function
End Class



more at http://www.siccolo.com/articles.asp


From: SAL on
I'm assuming you mean a GridView control since I don't see a control on the
Data tab called a DataGrid. If that's the case you can just use the
GridView's sort method

GridView1.Sort("FieldName", SortDirection)

HTH

S

"David C" <dlchase(a)lifetimeinc.com> wrote in message
news:Og3YzWG3IHA.4484(a)TK2MSFTNGP02.phx.gbl...
>I would like to sort the list of files (documents) that I am retrieving
>into a DataGrid control when they are first displayed. Currently they just
>list in the order that they appear in the directory and I would like to
>sort them on LastWriteTime property. Below is what I am using to populate
>the DataGrid. Thanks.
>
> David
>
>
> Dim dirInfo As New DirectoryInfo(strPathPhy)
> articleList.DataSource = dirInfo.GetFiles()
> articleList.DataBind()
>
>
>


 |  Next  |  Last
Pages: 1 2 3 4
Prev: Urgent... datagrid problem
Next: dynamic menu control