Public Class frmSubject
    Public SubjectID As Integer

    Dim State As FormState

    Public WriteOnly Property getFormState()
        Set(ByVal value)
            State = value
        End Set
    End Property

    Private Sub SubjectBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubjectBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.SubjectBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.SubjectDataSet)

    End Sub

    Private Sub frmSubject_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.SubjectTableAdapter.Fill(Me.SubjectDataSet.Subject)

        If State = FormState.adStateAddMode Then
            BindingNavigatorAddNewItem.PerformClick()
        End If
    End Sub
End Class