Bug or am I doing something wrong?

I have a form that displays detail of a record.  When the Form loads it fill the Form controls with the values of a single record by passing it a PK value. I have an Add button that clears the controls and allows entry of new information.  I also have some rudimentary validation behind the DataSet in its partial class. It is triggered by ColumnChanged. When there is invalid data this line is executed:
DataRecord.SetColumnError("CustomerCode", "Invalid Customer Code")
Whatis happening is that the first time I change a Column and this line is fired it fills all the controls on the form with values that were there before I cleared it. It does not change the column that I added something from which I changed.
LVL 1
Lisa0812Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AkisCCommented:
The dataset represents an in-memory cache of data
You have to use the DataSet.AcceptChanges Method
See the example bellow. it might help
Private Sub AcceptChanges()
   Dim myDataSet As DataSet
   myDataSet = new DataSet()
 
   ' Not shown: methods to fill the DataSet with data.
   Dim t As DataTable
 
   t = myDataSet.Tables("Suppliers")
 
   ' Add a DataRow to a table.
   Dim myRow As DataRow
   myRow = t.NewRow()
   myRow("CompanyID") = "NWTRADECO"
   myRow("CompanyName") = "NortWest Trade Company"
 
   ' Add the row.
   t.Rows.Add( myRow )
 
   ' Calling AcceptChanges on the DataSet causes AcceptChanges to be
   ' called on all subordinate objects.
   myDataSet.AcceptChanges()
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
p_davisCommented:
i am actually a little confused on what you want to happen

<<It does not change the column that I added something from which I changed.>>

what do you mean by this.-- are you actually trying to clear the values in the dataset from which you passed a record to this form?? do you want to remove?? how are you binding to your controls on the form displaying the record? what controls are you using?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.