1

As usual here is the code in my save button:

Private Sub Tbl_Student_InformationBindingNavigatorSaveItem_Click ...
        Me.Validate()
        Me.Tbl_Student_InformationBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.EnrollmentDataSet)
End Sub

Before saving, I need to modify one of the columns in the record to be saved. But how can I access it?

I tried to modify the field of the column named "Status" into "Active". Here is the code I decided to append just before Me.Validate().

Me.Tbl_Student_InformationBindingSource.Item("Status") = "Active"

This is wrong but it must be look like this, I think.

1
  • What is the data type of column Status ? If it is an enum or foreign key ID you probably need to set it to the equivalent integer/enum value instead of a string. Commented May 14, 2013 at 1:50

2 Answers 2

1
Private Sub Tbl_Student_InformationBindingNavigatorSaveItem_Click ...
    Me.Validate()
    Me.EnrollmentDataSet.Status="Active"
    Me.Tbl_Student_InformationBindingSource.EndEdit()        
    Me.TableAdapterManager.UpdateAll(Me.EnrollmentDataSet)
End Sub
Sign up to request clarification or add additional context in comments.

Comments

1

Well, after two months(I stopped using VB.net previously) I end up doing this:

Me.EnrollmentDataSet.Tables("tbl_Student_Information").Rows(Tbl_Student_InformationBindingSource.Position).Item("Status") = "Active"

I placed that code snippet just after the UpdateAll method, then after this(the code above), I called another UpdateAll.

This is one way to solve my problem, but I think there must be a better one.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.