473,394 Members | 1,739 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,394 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 7245
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

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...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.