473,657 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

moving rows in dataset

Sam
Hi,
I have a datagrid which datasource is a dataset.
I want to add a spin button to my form so that when the user click on
the up arrow, the selected row in the grid will be moved up by one
(same if the user click the down arrow). Has anybody done that before ?
Is it possible ? It seems quite hard, is the changes made to the
dataset going to be reflected to the grid ?
Thx

Nov 21 '05 #1
5 2604
Hi,

Maybe this will help
http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q832q

Ken
-------------------
"Sam" <sa************ **@voila.fr> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
Hi,
I have a datagrid which datasource is a dataset.
I want to add a spin button to my form so that when the user click on
the up arrow, the selected row in the grid will be moved up by one
(same if the user click the down arrow). Has anybody done that before ?
Is it possible ? It seems quite hard, is the changes made to the
dataset going to be reflected to the grid ?
Thx
Nov 21 '05 #2
Sam
no it doesnt ;)
I'm not using the microsoft datagrid... Anyway i've solved my problem
with this thread :

http://groups.google.co.uk/group/mic...97a433ff6f0df2

Thx

Nov 21 '05 #3
Sam,

You asked for a simple way.

When you want to use a difficult way, than I would use an extra datacolumn.
Loop in that a rownumber, set the defaultview on that, and swap the numbers.

And then use gridstyles to show the columns you want to show in the
datagrid.

Just my idea not tested,

Cor
Nov 21 '05 #4
Sam
sounds good. But I still prefer the method in the thread which i gave
the link above, it's more generic and easy to reuse for any grid.

thx

Nov 21 '05 #5
Sam,
sounds good. But I still prefer the method in the thread which i gave
the link above, it's more generic and easy to reuse for any grid.

Now I see it, I thought he was swapping the rows, however he is swapping the
data inside it I see now. A clever method yes.

However, when you use this dataset to update, take than care by the way of
the rowstates because this will set now both swapped rows to changed and I
don't know if that is your goal. I assume that you can get as well get some
trouble with new rows or with rows with a rowstate deleted when those exist
in the dataset.

Cor
Nov 21 '05 #6

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

Similar topics

3
2779
by: Tome73 | last post by:
How can I easily add the rows of DataTable1 to the rows of DataTable2. Both queries are from the same table. I can always use the column names with myRow, but I was wishing for a shortcut. When I try this it doesn’t work. for (int i = 0; i < dataTable1.Rows.Count; i++) { myRow = dataTable2.NewRow(); myRow = dataTable1.Rows; dataTable2.Rows.Add(myRow);
3
2539
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
3
4871
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 the best method? Do you have a sample of how to do this?
1
2814
by: Mark | last post by:
hi, i'm trying to cycle through a dataset to test if a row/column in a grid is the same as in the dataset. Just wondering if there's an easier way, the recordsets in old ado/asp seemed much easier to use and datareaders only being forward only is a pain. Dataset are very complex too. Code Below:
3
1623
by: Simon | last post by:
Hi everyone, I have a small problem regarding a wizard that I'm making on my website. The wizard is obviously a series of pages that take values from the user. My question is: - Should I store all the values entered until the last page and then update the database, or should I do it as I go.
12
1992
by: Graham Blandford | last post by:
Hi all, Would someone be able to tell me the most 'graceful' way of removing unwanted rows from a dataset based on a condition prior to update? OR, resetting the rows all to unchanged after they are initally added to the recordset. I create a dataset, which begins empty after the initial .Fill. Then I create several rows with some default information, leaving one
1
1296
by: Steve | last post by:
C# I have a screen with 2 datagrids on it. The screen is designed for allocating records from one datagrid to the other. Once a record has moved from one to the other, i refresh them both to show the change. To do the refresh though, currently I am sending a request back to the DB to refetch the records, which can obviously have performance hits. I have been able to refresh the datagrid which is losing the record, by creating a new...
3
1631
by: Don Miller | last post by:
In my migration from ASP to ASP.NET 2.0, I have a fair number of complicated HTML tables that defy anything .NET can do. Using classic ASP I created these tables (by string concatenation) by moving forward, and at times, backward through a recordset (using a static cursor rather than a forward-only cursor). I can't seem to find any methods in .NET to move to a previous row in a Dataset (e.g. MovePrev, MoveFirst). Am I trying to use the...
0
8403
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8316
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8833
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8610
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7345
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5636
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.