471,317 Members | 2,596 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Adding an unbound - row to a specific index - datagridview bound mode

Is it possible that - or is there any workarround for adding a new unbound row
to a datagridview at bound mode ?
Theese are not working. And i don 't want to add a row to dataset then rebind -
cause i want to add this row to a specific location. and it does not match to
sort order.

Regards. and thanks.

base.Rows.InsertCopy(base.CurrentRow.Index, 1);
base.Rows.Insert(base.CurrentRow.Index, 1);
base.Rows.AddCopies(base.CurrentRow.Index, 1);
base.Rows.InsertCopy(base.CurrentRow.Index, 1);

Jan 7 '06 #1
2 8189
inpuarg,

Well, in order to do this, you have to set your sort order such that the
row will be placed in the order that you desire.

The order of the rows in the data table have nothing to do with the sort
order on a view. You need to change the view so that the sort order will
expose the rows in the order you wish.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"inpuarg" <in*****@whereland.com> wrote in message
news:g4********************************@4ax.com...
Is it possible that - or is there any workarround for adding a new unbound
row
to a datagridview at bound mode ?
Theese are not working. And i don 't want to add a row to dataset then
rebind -
cause i want to add this row to a specific location. and it does not match
to
sort order.

Regards. and thanks.

base.Rows.InsertCopy(base.CurrentRow.Index, 1);
base.Rows.Insert(base.CurrentRow.Index, 1);
base.Rows.AddCopies(base.CurrentRow.Index, 1);
base.Rows.InsertCopy(base.CurrentRow.Index, 1);

Jan 7 '06 #2
well - i 've tried but i have some problems :

DataSet ds = (DataSet)base.DataSource;
DataTable dt = ds.Tables[0];
DataView dv = dt.DefaultView;

DataRow row = dv.Table.NewRow();
row["ID"] = System.Guid.NewGuid().ToString().ToUpper();

dv.Table.Rows.InsertAt(row, base.CurrentRow.Index + 1);
but when user change the default sort this is not working - what can i do ?

On Sat, 7 Jan 2006 15:49:41 -0500, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard.caspershouse.com> wrote:
inpuarg,

Well, in order to do this, you have to set your sort order such that the
row will be placed in the order that you desire.

The order of the rows in the data table have nothing to do with the sort
order on a view. You need to change the view so that the sort order will
expose the rows in the order you wish.

Hope this helps.


Jan 12 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Steven D'Aprano | last post: by
3 posts views Thread by Jim Heavey | last post: by
10 posts views Thread by Matthew Wells | last post: by
7 posts views Thread by Rainer Queck | last post: by
7 posts views Thread by troy_lee | 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.