Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / May 2006

Tip: Looking for answers? Try searching our database.

SortCompare of DataGridView - how to?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Botha - 22 May 2006 15:40 GMT
VS2005 and I have a DataTable displayed in a DataGridView that needs custom
sorting, with the DataSource of the grid set to the DataTable and the
SortCompare event just won't fire.

Then I found this in  the docs "This event occurs only when the DataSource
property is not set and the VirtualMode property value is false"
This seems really odd but may be true. I can't see what the purpose of this
event is then, how else will one use the DataGridView other than setting the
DataSource to something?

How else to do the custom sorting when the user clicks a column header is
also welcome.

Thanks.
Ken Tucker [MVP] - 22 May 2006 15:56 GMT
Chris,

     It fires when the datagridview is not bound to a datasource and
virtual mode is set to false.

Ken
-----------------------

> VS2005 and I have a DataTable displayed in a DataGridView that needs custom
> sorting, with the DataSource of the grid set to the DataTable and the
[quoted text clipped - 10 lines]
>
> Thanks.
Chris Botha - 22 May 2006 16:20 GMT
Hi Ken, thanks for the quick response. If you have it working, then I need
more assistance please. I've seen it in the docs, but what the heck does "is
not bound to a datasource" mean?
In my case I have a typed DataSet dataset obtained with a Web service call,
and sets the DataSource of the grid to be the DataTable in the dataset. Does
this cause the event not to fire? As mentioned, this seems really odd. Is
there another way of displaying the table in the grid other than setting the
datasource to the table so the event will fire?
I've tried the VirtualMode property in both its flavors and read all 3 pages
of links coming back with Google searching for DataGridView SortCompare.

> Chris,
>
[quoted text clipped - 22 lines]
>>
>> Thanks.
Ken Tucker [MVP] - 22 May 2006 17:24 GMT
Hi,

            Not bound to a datasource means that you add the columns and
cell values manually.

Here is a link to an example.
http://www.onteorasoftware.com/blog.aspx?BlogID=2

Ken
------------------------------

> Hi Ken, thanks for the quick response. If you have it working, then I need
> more assistance please. I've seen it in the docs, but what the heck does "is
[quoted text clipped - 33 lines]
> >>
> >> Thanks.
Chris Botha - 22 May 2006 18:07 GMT
Ken, thanks again, seems like the link does not work though?

> Hi,
>
[quoted text clipped - 52 lines]
>> >>
>> >> Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.