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

Reordering individual rows in a DataGridView?

Hi,

Is there a simple way to swap the position of two rows in an unbound
DataGridView? I am using it to display an ordered list, where I want the
up/down arrow keys to shuffle a row up and down the grid, but I can't see
any way to reposition a row within the grid without completely repopulating
it, which seems excessive. The Index value for a row is read-only.

John.
--

"I have nothing but the greatest respect for other peoples' crackpot
beliefs".
-- Sam the Eagle.

Jun 6 '06 #1
1 9008

"John" <ju**@junk.com> wrote in message
news:e6**********@perki.connect.com.au...
Hi,

Is there a simple way to swap the position of two rows in an unbound
DataGridView? I am using it to display an ordered list, where I want the
up/down arrow keys to shuffle a row up and down the grid, but I can't see
any way to reposition a row within the grid without completely
repopulating it, which seems excessive. The Index value for a row is
read-only.
to move a row, use
DataGridView.Rows.RemoveAt
and
DataGridView.Rows.Insert

John.
--

"I have nothing but the greatest respect for other peoples' crackpot
beliefs".
-- Sam the Eagle.

Jun 6 '06 #2

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

Similar topics

1
by: Luca Beretta | last post by:
I think this a simple question but i'm breaking my brain without results. I've a datagridview bounded to a datatable, with an imagecolumn that should contain a different bitmap depending from a...
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...
4
by: craig.wenger | last post by:
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,...
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: frostbb | last post by:
Greetings: Working on a VS2005 C# program. I have a DataGridView control that is bound to dataviews generated by various database queries. i.e. the user enters search criteria and the query...
0
by: Firona | last post by:
Hi, I'm trying to add several rows to a dataGridView. My current code adds the rows by calling the dataGridView.Rows.Add() method for every row. I know there is the dataGridView.Rows.AddRange()...
1
by: SePp | last post by:
Hello all, I want to display the number of items in an datagridview. I use this one datagridview for different datasets. The datagridview.Rowcount works fine for the most of the dataset. But...
6
by: =?Utf-8?B?TU1TSkVE?= | last post by:
How to let user delete multi rows from the BindingSource while the SelectionMode Property set to RowHeaderSelect I have in my program datagridview bound it to sql table Throw Bindingsource To...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
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,...

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.