473,378 Members | 1,354 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,378 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 8316
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Steven D'Aprano | last post by:
Suppose I create a class with some methods: py> class C: .... def spam(self, x): .... print "spam " * x .... def ham(self, x): .... print "ham * %s" % x .......
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
10
by: Matthew Wells | last post by:
Hello. I've converted a bound Access 2000 form which displays data retrieved from an Access 2000 database to an unbound form. Now my hyperlinks don't work. I'm assuming it's because the form...
7
by: Max | last post by:
I've included the needed tables in the DataSource. Those tables that are bound to controls I can workwith. But how do you get access to the DataAdaptors that are not bound? me.Dataset1.table...
3
by: Aspnot | last post by:
I have a form that is setup in a Master/Detail configuration. The Detail section is represented with a DataGridView. Some of the columns in this DataGridView control are unbound. When a user...
7
by: Rainer Queck | last post by:
Hi NG, Why is it, that in my DataGridView all columns which are not bound to a "DataProperty" loos thier content in a couple of occasions? This happens if: - Underlaying...
1
by: lgalumbres | last post by:
Hi, I have a datagrid on Winform that is bound to a datatable. In essence, what I would like to do is that when a user inputs a number into a textbox control for example 5 then 5 empty rows...
1
by: Martin | last post by:
Hi, I'm having a problem with a datagridview control when trying to read the value of an unbound checkbox cell. The code below works fine if I click on any text cell, bound or unbound, and...
7
by: troy_lee | last post by:
I have an unbound form. I have an Add New procedure that saves a new record to the database. What is the best way to update an existing record? In other words, clicking my "Submit record" button...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...

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.