Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Able to tell when bindingsource can EndEdit

Status
Not open for further replies.

SavantMan

Programmer
Apr 17, 2002
165
US
I have an application that uses the new bindingsource class (part of the V2 framework).

In addition, I'm binding the enabled property of certain buttons to properties of a wrapper class that I've written around the bindingsource. Most is working fine, but having difficulty with a couple of them.

I have my "Save" button enabled property bound to a property on the wrapper called CanEndEdit. When I step through the code, I know the property is returning a value at the correct time, but unless I've fired the AddNew method, it always returns false.

Here is the code

Code:
Public ReadOnly Property CanEndEdit() As Boolean
      Get
         If Not mBindingSource.Current Is Nothing Then
            Return DirectCast(mBindingSource.Current, DataRowView).Row.RowState <> DataRowState.Unchanged
         Else
            Return False
         End If
      End Get
   End Property

Basically the rowstate is returning as unchanged even though I know that changes have occurred?
 
I believe the RowState does not change until after you finish the edit, by moving to another record, calling EndEdit, etc.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Any suggestions for a value I can look at to determine if a record is currently being edited?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top