Public Class guestsForm
    Private Sub guestsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Try
            'create instance of the data tier component
            Dim guestData As New cottagesGuestContactData
            Dim guestDataSet As CottagesDataSet

            'get the data and assign data to guestDataSet
            guestDataSet = guestData.getGuestContactData

            'declare, instantiate, and set up the binding source
            Dim theBindingSource As New BindingSource
            With theBindingSource
                .DataSource = guestDataSet
                .DataMember = "Guests"
                '.Sort = "Name"
            End With

            'set up and bind combobox
            With NameComboBox
                .DataSource = theBindingSource
                .DisplayMember = "Name"
                .DataBindings.Add("text", theBindingSource, "Name", False, DataSourceUpdateMode.Never)
            End With

            'bind text fields
            PhoneTextBox.DataBindings.Add("text", theBindingSource, "Phone")
            StateTextBox.DataBindings.Add("text", theBindingSource, "State")
            EmailTextBox.DataBindings.Add("text", theBindingSource, "email")

        Catch ex As Exception

        End Try
    End Sub

    
End Class
