471,326 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Datagridview InsertAt

I have 2 column :
Column1 Column2
A 25
B 20
C 15
D 10
E 5

After i load form, i move current cell to D and my currentcell.rowindex is 4
grid.CurrentCell.RowIndex = 4
Then i sort by clicking column2 . And my currentcell.rowindex is 2.
I add a row by using insertat function :

DataSet ds = (DataSet)grid.DataSource;
DataTable dt = ds.Tables[0];

DataRow row = dt.NewRow();
row["ID"] = System.Guid.NewGuid().ToString().ToUpper();
dt.Rows.InsertAt(row, base.CurrentCell.RowIndex + 1);

But due to sort order this row goes to first row.
I don 't want this. I want that empty cell to locate 3 'rd row.
How can i customize that sort and implement this feature ?

Jan 13 '06 #1
0 2282

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Kelvin | last post: by
reply views Thread by Kelvin | last post: by
1 post views Thread by inpuarg | last post: by
3 posts views Thread by Andrus | last post: by

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.