Row state not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    Row state not working

    Hi

    I have a winform db app that uses the following code to bind data source to
    the form fields;

    Private ds As MyDataSet
    Dim db As System.Windows. Forms.Binding
    Private WithEvents bmCompanyDetail s As
    System.Windows. Forms.CurrencyM anager

    db = New System.Windows. Forms.Binding(" Text", ds.tblClients, "ID")
    txtID.DataBindi ngs.Add(db)

    db = New System.Windows. Forms.Binding(" Text", ds.tblClients,
    "Company")
    txtCompany.Data Bindings.Add(db )

    '...more field bindings

    bmCompanyDetail s = CType(BindingCo ntext(ds, "tblClients "),
    CurrencyManager )

    EndWait()

    When the user edits some fields and presses Save, following code is
    executed;

    Dim Row As DataRow

    bmCompanyDetail s.EndCurrentEdi t()
    Row = DirectCast(bmCo mpanyDetails.Cu rrent, DataRowView).Ro w
    If Row.RowState = DataRowState.Mo dified Then
    ' Update here
    End IF

    Problem is that despite the fact data is changed in bound fields,
    Row.RowState returns Unchanged state. What is the problem and how can I fix
    it?

    Thanks

    Regards



  • Jibesh

    #2
    Re: Row state not working

    John,

    Are sure you were not called AcceptChanges() method of dataset any where in
    the program flow before the Save operation peformed.

    Also make sure that editing is done on the proper row. try changing the
    textbox field value fully rather changing some chars.

    Thanks
    Jibesh


    "John" <info@nospam.in fovis.co.ukwrot e in message
    news:OQNL$8QHJH A.4600@TK2MSFTN GP06.phx.gbl...
    Hi
    >
    I have a winform db app that uses the following code to bind data source
    to the form fields;
    >
    Private ds As MyDataSet
    Dim db As System.Windows. Forms.Binding
    Private WithEvents bmCompanyDetail s As
    System.Windows. Forms.CurrencyM anager
    >
    db = New System.Windows. Forms.Binding(" Text", ds.tblClients, "ID")
    txtID.DataBindi ngs.Add(db)
    >
    db = New System.Windows. Forms.Binding(" Text", ds.tblClients,
    "Company")
    txtCompany.Data Bindings.Add(db )
    >
    '...more field bindings
    >
    bmCompanyDetail s = CType(BindingCo ntext(ds, "tblClients "),
    CurrencyManager )
    >
    EndWait()
    >
    When the user edits some fields and presses Save, following code is
    executed;
    >
    Dim Row As DataRow
    >
    bmCompanyDetail s.EndCurrentEdi t()
    Row = DirectCast(bmCo mpanyDetails.Cu rrent, DataRowView).Ro w
    If Row.RowState = DataRowState.Mo dified Then
    ' Update here
    End IF
    >
    Problem is that despite the fact data is changed in bound fields,
    Row.RowState returns Unchanged state. What is the problem and how can I
    fix it?
    >
    Thanks
    >
    Regards
    >
    >
    >

    Comment

    Working...