Hello,
I would like to get message, or true result when DataSet get new record (new row). But, I always get message as "no".

Button1 is add new record

Me.Table1BindingSource.AddNew()

Button2 is save a record

Me.Validate()
        Me.Table1BindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.TestDataSet)

Button3 should return "Yes" as new record has been added, but does not?!

If TestDataSet.HasChanges(DataRowState.Added) Then
            MsgBox("yes")
        Else
            MsgBox("no")
        End If

Thank you in advance for help.

Hi, try the code below, it worked for me,

'check if the datasets row state = added
if me.dataset.table.row(me.bindingsource.position).rowstate = datarowstate.added then

messagebox.show("yes")

else

messagebox.show("no")

endif

Thanks for reply.
I have found that order of executes was wrong. After EndEdit I got True values as "yes".

Me.Validate()        
Me.Table1BindingSource.EndEdit()   

If TestDataSet.HasChanges(DataRowState.Added) Then            
MsgBox("yes")        
Else           
MsgBox("no")        
End If 
     
Me.TableAdapterManager.UpdateAll(Me.TestDataSet
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.