?
Solved

Bug or am I doing something wrong?

Posted on 2008-01-26
2
Medium Priority
?
181 Views
Last Modified: 2013-11-26
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.
0
Comment
Question by:Lisa0812
2 Comments
 
LVL 11

Accepted Solution

by:
AkisC earned 200 total points
ID: 20756465
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
 
LVL 22

Expert Comment

by:p_davis
ID: 20763019
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

593 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question