DataRowState not working as expected
-
Hi, I'm trying to determine if the row has been modified. I have used Visual Studio 2010 and dragged the controls onto the form, so VS has built everything. When a direction button on the navigator is clicked, I run this code.
x = Convert.ToInt32(reunionBindingNavigator.PositionItem.Text); DataRow dr = KTReunionDataSet.Reunion.Rows\[x\]; Debug.WriteLine(dr.RowState.ToString()); if (dr.RowState == DataRowState.Modified) return;
I start with row one, change the date on the calendar, click next, row 2 is now showing, don't modify anything on row 2, click the back button so we are now on Row 1, yet dr.RowState shows as UnModified. Did I do something wrong or am I missing something? Thank you,
Glenn
-
Hi, I'm trying to determine if the row has been modified. I have used Visual Studio 2010 and dragged the controls onto the form, so VS has built everything. When a direction button on the navigator is clicked, I run this code.
x = Convert.ToInt32(reunionBindingNavigator.PositionItem.Text); DataRow dr = KTReunionDataSet.Reunion.Rows\[x\]; Debug.WriteLine(dr.RowState.ToString()); if (dr.RowState == DataRowState.Modified) return;
I start with row one, change the date on the calendar, click next, row 2 is now showing, don't modify anything on row 2, click the back button so we are now on Row 1, yet dr.RowState shows as UnModified. Did I do something wrong or am I missing something? Thank you,
Glenn
Hi Glenn, I have used this code. It will work correctly. int x = Convert.ToInt32(bindingNavigator1.PositionItem.Text); DataRow dr = dt.Rows[x-1]; if (dr.RowState == DataRowState.Modified) { MessageBox.Show("Modified"); } I don't know what you have done in second line. Which component(KTReunionDataSet)you are using?. Thanks, Gopal.S
Gopal.S