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

Datagrid new row update problem.

BFX
Hi All,

I have datagrid with binding on dataset
this.grdMachineType.DataMember = "MachineTypes";

this.grdMachineType.DataSource = this.dsMachineTypes;

After append new row in datagrid i call this

private void tbMachineTypes_ButtonClick(object sender,
System.Windows.Forms.ToolBarButtonClickEventArgs e)

{

this.grdMachineType[this.grdMachineType.CurrentRowIndex,1] = false;

this.dsMachineTypes.GetChanges();

this.grdMachineType.BindingContext[this.dsMachineTypes.MachineTypes].EndCurr
entEdit();

this.daMachineT.Update(this.dsMachineTypes.Machine Types);

this.dsMachineTypes.AcceptChanges();

}

but databze haven't any changes .

If I after adding new row select another row and call save
tbMachineTypes_ButtonClick row is added.

thank's in advance for help

BFX


Jul 21 '05 #1
6 1612
BFX
After tests i know that problem is when user dont press enter after insert
value to datagrid cell.
I try use
SendKeys.Send("{ENTER}");

but it's without any reason.

Could anyone help with this problem?

thanks
"BFX" <bf***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi All,

I have datagrid with binding on dataset
this.grdMachineType.DataMember = "MachineTypes";

this.grdMachineType.DataSource = this.dsMachineTypes;

After append new row in datagrid i call this

private void tbMachineTypes_ButtonClick(object sender,
System.Windows.Forms.ToolBarButtonClickEventArgs e)

{

this.grdMachineType[this.grdMachineType.CurrentRowIndex,1] = false;

this.dsMachineTypes.GetChanges();

this.grdMachineType.BindingContext[this.dsMachineTypes.MachineTypes].EndCurr entEdit();

this.daMachineT.Update(this.dsMachineTypes.Machine Types);

this.dsMachineTypes.AcceptChanges();

}

but databze haven't any changes .

If I after adding new row select another row and call save
tbMachineTypes_ButtonClick row is added.

thank's in advance for help

BFX

Jul 21 '05 #2
BFX.

this.dsMachineTypes.GetChanges();

this.grdMachineType.BindingContext[this.dsMachineTypes.MachineTypes].EndCurr
entEdit();


When you do the EndCurrentEdit than the dataset can probably get changes.

Therefore I would change these two rows from position.

Don't nock to hard on your head when you read this, I don't see often
directly this kind of mistakes in my own programs.

I hope this helps,

Cor

Jul 21 '05 #3
BFX
Thaks for answer but I think problem is that dataset cannot get changes when
user dont't press enter after edit datagrid cell.
But I don't see why EndCurrentEdit and SendKeys.Send("{ENTER}"); don't cause
End Editing process on datagrid.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:eu*************@TK2MSFTNGP10.phx.gbl...
BFX.

this.dsMachineTypes.GetChanges();

this.grdMachineType.BindingContext[this.dsMachineTypes.MachineTypes].EndCurr entEdit();


When you do the EndCurrentEdit than the dataset can probably get changes.

Therefore I would change these two rows from position.

Don't nock to hard on your head when you read this, I don't see often
directly this kind of mistakes in my own programs.

I hope this helps,

Cor

Jul 21 '05 #4
BFX

I see some strange code in what you show, however see this sample.

See this sample
You have in your datagrid
1
3
5
When the users changes the 3 in a 4 and clicks the button, nothing happens
in the datagrid and in the dataset until that he changes the row or there is
done an endcurrentedit on the right datasource, what forces to push the
changes down in the datasource accoording to the bindingcontext.

There is in my opinion some strange code in what you show. I did not see it
the first time.

this.dsMachineTypes.GetChanges();
This is a result and would normally be after the endcurrentedit

If (this.dsMachineTypes.HasChanges())
DataSet dsChanges = this.dsMachineTypes.GetChanges();

(And than do the update with that dsChanges. Than the acceptchanges on the
original dataset is needed because the dataset with changes is a copy. In
the way you show it now with the original dataset is the acceptchanges
already done by the dataadapter)

I hope this helps,

Cor

"BFX" <bf***@hotmail.com> schreef in bericht
news:%2***************@TK2MSFTNGP09.phx.gbl...
Thaks for answer but I think problem is that dataset cannot get changes
when
user dont't press enter after edit datagrid cell.
But I don't see why EndCurrentEdit and SendKeys.Send("{ENTER}"); don't
cause
End Editing process on datagrid.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:eu*************@TK2MSFTNGP10.phx.gbl...
BFX.
>
> this.dsMachineTypes.GetChanges();
>
> this.grdMachineType.BindingContext[this.dsMachineTypes.MachineTypes].EndCurr > entEdit();
>


When you do the EndCurrentEdit than the dataset can probably get changes.

Therefore I would change these two rows from position.

Don't nock to hard on your head when you read this, I don't see often
directly this kind of mistakes in my own programs.

I hope this helps,

Cor


Jul 21 '05 #5
BFX
Thank's Cor,

but solving of my problem was easy, see folow

this.dsMachineTypes.AcceptChanges();

grdMachineType.CurrentRowIndex = -1; // it's :)

this.grdMachineType.BindingContext[this.dsMachineTypes.MachineTypes].EndCurr
entEdit();

this.daMachineT.Update(this.dsMachineTypes.Machine Types);

"Cor Ligthert" <no************@planet.nl> wrote in message
news:e6*************@tk2msftngp13.phx.gbl...
BFX

I see some strange code in what you show, however see this sample.

See this sample
You have in your datagrid
1
3
5
When the users changes the 3 in a 4 and clicks the button, nothing happens
in the datagrid and in the dataset until that he changes the row or there is done an endcurrentedit on the right datasource, what forces to push the
changes down in the datasource accoording to the bindingcontext.

There is in my opinion some strange code in what you show. I did not see it the first time.

this.dsMachineTypes.GetChanges();
This is a result and would normally be after the endcurrentedit

If (this.dsMachineTypes.HasChanges())
DataSet dsChanges = this.dsMachineTypes.GetChanges();

(And than do the update with that dsChanges. Than the acceptchanges on the
original dataset is needed because the dataset with changes is a copy. In
the way you show it now with the original dataset is the acceptchanges
already done by the dataadapter)

I hope this helps,

Cor

"BFX" <bf***@hotmail.com> schreef in bericht
news:%2***************@TK2MSFTNGP09.phx.gbl...
Thaks for answer but I think problem is that dataset cannot get changes
when
user dont't press enter after edit datagrid cell.
But I don't see why EndCurrentEdit and SendKeys.Send("{ENTER}"); don't
cause
End Editing process on datagrid.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:eu*************@TK2MSFTNGP10.phx.gbl...
BFX.

>
> this.dsMachineTypes.GetChanges();
>
>

this.grdMachineType.BindingContext[this.dsMachineTypes.MachineTypes].EndCurr
> entEdit();
>

When you do the EndCurrentEdit than the dataset can probably get changes.
Therefore I would change these two rows from position.

Don't nock to hard on your head when you read this, I don't see often
directly this kind of mistakes in my own programs.

I hope this helps,

Cor



Jul 21 '05 #6
> Thank's Cor,

but solving of my problem was easy, see folow
this.dsMachineTypes.AcceptChanges();
grdMachineType.CurrentRowIndex = -1; // it's :)
this.grdMachineType.BindingContext[this.dsMachineTypes.MachineTypes].EndCurr
entEdit();
this.daMachineT.Update(this.dsMachineTypes.Machine Types);

And you are sure that with this code, when somebody changing first the rows
in the grid before clicking on the button, update the changes.

It will in my opinion be a miracle however when you say so. For the rest it
is accoording what I tried to tell you all the time, where I was thinking
that you were updating using the getchanges method.

In this way will withouth that acceptchanges probably this enough.
\\\
BindingContext[dsMachineTypes.MachineTypes].EndCurrentEdit();
////

Cor
Jul 21 '05 #7

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

Similar topics

2
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
9
by: Pam Ammond | last post by:
After clicking btnDeleteSize_Click in frmSize, I move to frmSizeDelete, allow deleting a Size using a datagrid, and then return to frmSize and want to update the datagrid in frmSize to reflect the...
4
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. ...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
0
by: Steve | last post by:
I have a datagrid that is created at run time DataGrid dgG = new DataGrid(); BoundColumn bcB; dgG.CellPadding = 5; dgG.CellSpacing = 0; dgG.GridLines = GridLines.Both; dgG.CssClass =...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
5
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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...

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.