473,811 Members | 3,314 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Saving changes in datagrid with one row.

I have a datagrid with just one row. When I edit the contents of the datagrid and click on Save button (somewhere else in the form), the changes are lost. However, if I click TAB from the editable column of the datagrid, the changes are saved. Is there a way to save the changes without clicking TAB button ?
Nov 16 '05 #1
4 2413
Hi,

Two steps are required:

1. Call EndEdit on the DataGrid passing "false" as the "shouldAbor t"
argument value
2. Call EndCurrentEdit on the currency manager serving this grid. The
currency manager can be obtained like this:

CurrencyManager cm =
(CurrencyManage r)this.BindingC ontext[dataGrid.DataSo urce,
dataGrid.DataMe mber];

"Sangeetha. " <an*******@disc ussions.microso ft.com> wrote in message
news:29******** *************** ***********@mic rosoft.com...
I have a datagrid with just one row. When I edit the contents of the

datagrid and click on Save button (somewhere else in the form), the changes
are lost. However, if I click TAB from the editable column of the datagrid,
the changes are saved. Is there a way to save the changes without clicking
TAB button ?

Nov 16 '05 #2
Thanx a ton ! It works !!
Nov 16 '05 #3
Dmitry,

I am facing the same problem.
one thing I dont understand -
the EndEdit method requires a column and a row number - is there a way to
EndEdit on the whole datagrid?

thanx

Picho

"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:OS******** ******@TK2MSFTN GP11.phx.gbl...
Hi,

Two steps are required:

1. Call EndEdit on the DataGrid passing "false" as the "shouldAbor t"
argument value
2. Call EndCurrentEdit on the currency manager serving this grid. The
currency manager can be obtained like this:

CurrencyManager cm =
(CurrencyManage r)this.BindingC ontext[dataGrid.DataSo urce,
dataGrid.DataMe mber];

"Sangeetha. " <an*******@disc ussions.microso ft.com> wrote in message
news:29******** *************** ***********@mic rosoft.com...
I have a datagrid with just one row. When I edit the contents of the datagrid and click on Save button (somewhere else in the form), the

changes are lost. However, if I click TAB from the editable column of the datagrid, the changes are saved. Is there a way to save the changes without clicking
TAB button ?

Nov 16 '05 #4
Not sure - but you can easily obtain the two through the CurrentCell (or
something similar) property.
Or, would Mr. Sangheeta be so kind to post his code snippet here? ;-)

"Picho" <pi***********@ telhai.ac.il> wrote in message
news:uR******** ******@TK2MSFTN GP12.phx.gbl...
Dmitry,

I am facing the same problem.
one thing I dont understand -
the EndEdit method requires a column and a row number - is there a way to
EndEdit on the whole datagrid?

thanx

Picho


Nov 16 '05 #5

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

Similar topics

2
1332
by: Oldhandandy | last post by:
I have a datagrid linked to a SQL Stored Procedure, the data is extracted from 4 tables. Data is only updated not inserted and the update is to only 1 of the tables, the other three tables are information only. Can anybody help with a save routine.
0
1347
by: Jan Keller | last post by:
Hello all, I am using an XmlTextReader and a DataSet to populate a DataGrid: ds = New DataSet xr = New XmlTextReader(path) ds.ReadXml(xr) xr.Close() dv = New DataView(ds.Tables.Item(0))
1
5005
by: David K. | last post by:
Hi all, I am using a Windows Forms DataGrid control. I would like to save to database any changes I made directly in the datagrid control (either adding, changing or deleting), - by using the Update() adapter method. Please, let me know if it is possible and how it should be done. Thanks, David
4
5360
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. Currently everything is working. I can find the updated rows/columns by parsing the posted data collection against the DataGrid DataSource. However, when there is a large amount of DataGridItems (rows) the update processing can take a while. ...
14
1758
by: Ron L | last post by:
All I am working with a DataGrid and a form consisting of a number of text, checkbox, combobox controls, all bound to the same datatable. When I click on my "New" button, I create a new row, make it the current row, and allow the user to make changes in the form. If the user desires to cancel, they can click the "Cancel Changes" button. Here is where my problems start. Once the Cancel Changes button is clicked, the bindings on the...
0
3633
by: Patty05 | last post by:
I have a datagrid on a form that update properly when form loads. When the program runs and I type in/add a new row in the datagrid, it does not save the changes. Any help would be greatly appreaciated. Thanks. Code below: Imports System.Data.OleDb Public Class Form2 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code "
1
2039
by: Allie | last post by:
Hi, all. This might be a silly question... but I am very new to programming in SQL so please bear with me :) So. I'm using MS SQL Server 2005 Management Studio Express. I have a table that was created via an existing .sql file. Included were a bunch of stored procedures. I went in to re-format these procedures. (They were written in haste by another programmer. It is my task to go back and improve their readabilities.) However, I am...
0
1057
by: gyap88 | last post by:
I'm using VB 2005 to create a simple application where authorised users can edit the database. Firstly, the database will be imported into a datatable and into a datagrid. Public Class Databaseupdatting Dim dt As New DataTable() Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load dt.Clear() Dim SQLCon As New SqlClient.SqlConnection("Data...
27
6919
by: RobG | last post by:
I was investigating a function to determine whether daylight saving was being observed on a particular date (given the platform's regional settings) and came across a suggestion at merlyn.com to test the time zone offset on a variety of dates to see if it changes. Based on that, I developed the following checkDST() function which, as far as I can tell, should be sufficient. It checks either the date passed to it or the current date with...
0
9731
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
9605
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
10651
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
10393
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...
1
10405
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7671
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
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();...
0
5556
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3020
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.