473,545 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

new rows are added to top of DataGridView

I am using a DataGridView to display information stored in classes. I
am linking to the information with the Tag property of the
DataGridView rows. Unfortunately, whenever I set the Tag property,
update all its associated cells, and then add a new row, it adds the
blank row to the top of the grid. It seems like it would be more
logical to me to add the new row to the bottom of the grid. Before I
started using the Tag property of the rows, and just kept an
independent list of items to store the information, I didn't have this
problem, even though I am not sure what the difference is.

Mar 24 '07 #1
4 4999
Is your DataGridView or its datasource sorted? Is the new row being
placed in it proper psoition in the sort order?

=============== =======
Clay Burch
Syncfusion, Inc.

Mar 25 '07 #2
On Mar 24, 4:57 pm, "ClayB" <c...@syncfusio n.comwrote:
Is your DataGridView or its datasource sorted? Is the new row being
placed in it proper psoition in the sort order?

=============== =======
Clay Burch
Syncfusion, Inc.
No, all of the columns are set to NotSortable. There is no true
datasource because I just use the Tag property of each row, there is
no actual data binding.

Mar 25 '07 #3
On Mar 24, 4:30 pm, craig.wen...@gm ail.com wrote:
I am using a DataGridView to display information stored in classes. I
am linking to the information with the Tag property of the
DataGridView rows. Unfortunately, whenever I set the Tag property,
update all its associated cells, and then add a new row, it adds the
blank row to the top of the grid. It seems like it would be more
logical to me to add the new row to the bottom of the grid. Before I
started using the Tag property of the rows, and just kept an
independent list of items to store the information, I didn't have this
problem, even though I am not sure what the difference is.
It seems the Tag property only stays with the bottom row. Even after
adding two rows and setting the Tag property only one row will show
this value as something other than null. Maybe the Tag property is not
the best approach for this. I guess a more general question would be,
is there any way to link classes to rows in a DataGridView without
databinding and without maintaining a separate list. A separate list
would get tricky in that event that the DataGridView is sorted.

Mar 25 '07 #4
On Mar 24, 8:44 pm, "craig.wen...@g mail.com" <craig.wen...@g mail.com>
wrote:
On Mar 24, 4:30 pm, craig.wen...@gm ail.com wrote:
I am using a DataGridView to display information stored in classes. I
am linking to the information with the Tag property of the
DataGridView rows. Unfortunately, whenever I set the Tag property,
update all its associated cells, and then add a new row, it adds the
blank row to the top of the grid. It seems like it would be more
logical to me to add the new row to the bottom of the grid. Before I
started using the Tag property of the rows, and just kept an
independent list of items to store the information, I didn't have this
problem, even though I am not sure what the difference is.

It seems the Tag property only stays with the bottom row. Even after
adding two rows and setting the Tag property only one row will show
this value as something other than null. Maybe the Tag property is not
the best approach for this. I guess a more general question would be,
is there any way to link classes to rows in a DataGridView without
databinding and without maintaining a separate list. A separate list
would get tricky in that event that the DataGridView is sorted.
I figured it out. I was editing the 'new' row at the bottom of the
DataGridView and then adding a new row, instead of adding a new row
and then editing it.

Mar 27 '07 #5

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

Similar topics

3
32250
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 datatable without having to loop through each column in the datagridview? Or is there a way to retrieve the rows from the original datatable...
2
6167
by: Ryan | last post by:
I want to programmatically add a row to DataGridView (a datasource was binded with it), but when I call the method DataGridView.Rows.Add, a System.InvalidOperationException will be thrown and the error message is: Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound. But if I create a...
2
12566
by: shalakasan | last post by:
Hi, I am new to the forms world and have a silly doubt. I have form with a DataGridview and an "Add" button. When the user clicks on the add button, one row gets added to the datagrid. Now I want that when the user hits the "Add" button, then new row should be added and all the previous rows should be disabled for selection/editing. ...
6
19659
by: Bill Nguyen | last post by:
I tried almost everything ..Rows.clear() ..rowcount = 0 and the rows in a datagridview still not cleared I populated the Datagridview manually using Row.Add Any help is greatly appreciated Bill
4
19720
by: Vidhura | last post by:
This article explains how to make all the rows height the same in DataGridView in .Net 2.0 while using AutoSizeRowMode In DataGridView 2.0,there is a option to resize row to fit the content of the cell.This will increase the row height. this.dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.DisplayedCells; But the row heights...
3
3094
by: =?Utf-8?B?S2F5xLFoYW4=?= | last post by:
In my project,i added datagridview to my form , i transfered my table to datagridview and added multiple rows and when i called dataadapther.update ,,result is ok. But when i tried it for the delete operations,i got the error like "set primary key in your table" ,,i want delete multiple rows from Datatable which doesnt contain primary key
1
1724
by: JustinD30324 | last post by:
Hello. I have a DataGridView that is bound to a DataTable. If the user types in values for all the columns for the first row, then clicks into a column in the second row (empty), and then clicks back into the first row he just typed, then an empty row is added to the DataGridView. I'm guessing that somehow the AddRow function is being called...
3
9671
by: jehugaleahsa | last post by:
Hello: I am binding a DataGridView with a BindingList<T>, where T is a custom business object that implements INotifyPropertyChanged. When you bind a DataGridView to a DataTable, it has this cool little feature - it will not call DataTable.Rows.Add until after you leave the DataGridView row. This is cool because it lets your user edit the...
2
7561
by: jogisarge | last post by:
Hi @all, ich have a datatable added to a dataset. the dataset is binded to a datagridview. How can i get all modified rows from the dataset ? I have to check all the modified rows in a loop.
0
7401
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
5971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5326
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1879
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
703
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.