473,385 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SortCompare of DataGridView - how to?

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.
May 22 '06 #1
4 4587
Chris,

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

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

"Chris Botha" wrote:
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.

May 22 '06 #2
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.
"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:E3**********************************@microsof t.com...
Chris,

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

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

"Chris Botha" wrote:
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.

May 22 '06 #3
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
------------------------------
"Chris Botha" wrote:
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.
"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:E3**********************************@microsof t.com...
Chris,

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

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

"Chris Botha" wrote:
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.


May 22 '06 #4
Ken, thanks again, seems like the link does not work though?

"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
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
------------------------------
"Chris Botha" wrote:
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.
"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in
message
news:E3**********************************@microsof t.com...
> Chris,
>
> It fires when the datagridview is not bound to a datasource and
> virtual mode is set to false.
>
> Ken
> -----------------------
>
> "Chris Botha" wrote:
>
>> 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.
>>
>>
>>


May 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DraguVaso | last post by:
Hi, I'm using the DataGridView in VB.NET 2.0. The DataSource is a Generic List of a custom class0: lstMyPersonnes = New List(Of clsPersonne). When I add a new clsPersonne to lstMyPersonnes,...
10
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got...
3
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate...
4
by: Chris Botha | last post by:
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...
2
by: bob | last post by:
Can anyone tell me the best way to update a dataset while it is being edited/viewed in the DataGridView control? Is this something that should be inserted into one of the grid's events? or should...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: jeastman - Hotmail | last post by:
Hello world Excuse, not to be written English and it helps me with a translator. I am new programming in C#. I made a control inheriting the DataGridView to be able to add controls done by...
3
by: Andrus | last post by:
I have DataGridView in virtual mode containing 3500 rows. In code below, assigning to RowCount value to 3500 takes 8 seconds. CPU usage goes high at this time. Stepping by F11 into user code shows...
0
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.