Nerdy_Girl88
asked on
Adding a new record to the dataset.
Hi, this probably sound like a silly Question....So should be some easy point.
I want to Add a new record to a dataSet, I know how to add a new record to the dataset. My problem is setting the form controls up to accept the new data.
Currently I have a form with a combobox and two text boxes.
They are all bound to the same dataset. Dataset1.
I have a add button that will clear the text boxes and allow the user to enter data form the new record. This is where the problem starts, I only clear the textboxes for the user, the binding architeture recognises it as a changed dataset record. I have a button that will save the values in the text boxes as a new row in the dataset. This work good. accpet the current record in the dataset is effected.
My problem occurred when i tried to cancel the add action, the cleared forms stay and the dataset through they were changes to the current record.
How do i prevent the dataset from accepting the change made.
How do I prepare the form to accpet new values with out effecting the bound dataset.
thanks
I want to Add a new record to a dataSet, I know how to add a new record to the dataset. My problem is setting the form controls up to accept the new data.
Currently I have a form with a combobox and two text boxes.
They are all bound to the same dataset. Dataset1.
I have a add button that will clear the text boxes and allow the user to enter data form the new record. This is where the problem starts, I only clear the textboxes for the user, the binding architeture recognises it as a changed dataset record. I have a button that will save the values in the text boxes as a new row in the dataset. This work good. accpet the current record in the dataset is effected.
My problem occurred when i tried to cancel the add action, the cleared forms stay and the dataset through they were changes to the current record.
How do i prevent the dataset from accepting the change made.
How do I prepare the form to accpet new values with out effecting the bound dataset.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please Post the Tutorial
Thanks
Dan
Thanks
Dan
ASKER
Sorry the tutorial was found in a book that i brought called.
Advanced Programming in VB.net
by Julia Case Bradley and Anita C. Millspaugh.
I also have:
Programming in VB.net
by Julia Case Bradley and Anita C. Millspaugh.
These books where excellent for learning the basics.
Along with this help website.
Sorry. can't help much this one.
Advanced Programming in VB.net
by Julia Case Bradley and Anita C. Millspaugh.
I also have:
Programming in VB.net
by Julia Case Bradley and Anita C. Millspaugh.
These books where excellent for learning the basics.
Along with this help website.
Sorry. can't help much this one.
ASKER
I have am using this function on cancel so it will replace all the data cleared by the add button action.
--------------------------
Private Sub rejectChanges()
'set all the value back to what they were before
Dim intRecordPosition As Integer = Me.BindingContext(Me.mData
Dim curRow As DataRow = Me.mDataObj.DsFrmModel1.Mo
Try
Me.txtModelID.Text = curRow("Model_ID", DataRowVersion.Original).T
Me.txtModelName.Text = curRow("Model_Name", DataRowVersion.Original).T
Me.txtPicture.Text = curRow("Picture", DataRowVersion.Original).T
Me.RtxFeatures.Text = curRow("Standard Features", DataRowVersion.Original).T
Catch ex As Exception
MessageBox.Show(ex.Message
End Try
End Sub
--------------------------
Thanks. I have found a good tutorial that is showing me how to add the add,edit and delete buttons
thanks, here are some easy points.