473,396 Members | 1,997 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,396 software developers and data experts.

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 4985
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...@syncfusion.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...@gmail.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...@gmail.com" <craig.wen...@gmail.com>
wrote:
On Mar 24, 4:30 pm, craig.wen...@gmail.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
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...
2
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...
2
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...
6
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 ...
4
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...
3
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...
1
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...
3
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...
2
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...
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:
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.