Cannot add a newrow after a row has been deleted.....:(

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm going nuts using the currencymanager. Am I the only person using this
manager, I'm not getting any replies to my post, neither do I see anyone
posting similar problems. Maybe I'm not using it the way, it's supposed to
be, some one please help me out..

I'm doing a delete of a newrow added depending on user selection, and then
adding another new row, but it just doesn't get added. Does that make sense.
ok.
Here's the code.

Private sub Addnewrow()
drNewRow = dsAssignMaster.Tables("AssignMaster").DefaultView.AddNew

drNewRow.BeginEdit()
'/////Set All Checkboxes and comboboxes and not null values.
drNewRow.Item("StateId") = cboState.SelectedValue
drNewRow.Item("CountryId") = cboCountry.SelectedValue
drNewRow.Item("FollowupRequired_r") = False
drNewRow.Item("InvoiceRequired") = False
drNewRow.Item("AssignmentId") = "NewRow"
CurrMgrForm.Position =
dsAssignMaster.Tables("AssignMaster").DefaultView.Find("NewRow")

End Sub
'///////////Delete the newly added row if the user navigates to a different
record.////
Private Sub butRefresh_Click
If NewRow Then
CType(CurrMgrForm.Current, DataRowView).Row.Delete()
CurrMgrForm.EndCurrentEdit()
dsAssignMaster.Tables("AssignMaster").AcceptChanges()
End If
AssignmentId = ""
RefreshasNewForm()
End Sub


After this I call the Addnewrow based on user selection, but the row doesn't
get added. The number of rows in the table remains the same.

What else is required here.


Any help is appreciated.
Debi
 
Debi,

I can not imaging what you write, at least I have seen beside me that Miha
points people to the currencymanager.addnew method

http://msdn.microsoft.com/library/d...ndowsformscurrencymanagerclassaddnewtopic.asp

And almost everybody active here in this newsgroup tells forever not to use
accept inside an update procedure.

In your case
A remove, removes a datarow completely from a datatable
From a deleted datrow is the rowstate set to deleted when it is not a new
added row because than it is removed

With an acceptchanges all those rowstates are set to done and the as deleted
marked rows will be removed.

I hope this helps?

Merry Christmas

Cor
 
Back
Top