Public Class FacultyForm

    Private Sub FacultyForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        ComboName.Items.Add("Ying Bai")
        ComboName.Items.Add("Satish Bhalla")
        ComboName.Items.Add("Black Anderson")
        ComboName.Items.Add("Steve Johnson")
        ComboName.Items.Add("Jenney King")
        ComboName.Items.Add("Alice Brown")
        ComboName.Items.Add("Debby Angles")
        ComboName.Items.Add("Jeff Henry")
        ComboName.SelectedIndex = 0

    End Sub

    Private Sub cmdSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSelect.Click
        Dim FacultyTableApt As New CSE_DEPTDataSetTableAdapters.FacultyTableAdapter
        Dim strName As String

        strName = FindName(ComboName.Text)
        If strName = "No Match" Then
            MessageBox.Show("No Matched Faculty Found!")
            Exit Sub
        End If
        PhotoBox.SizeMode = PictureBoxSizeMode.StretchImage
        PhotoBox.Image = System.Drawing.Image.FromFile(strName)
        FacultyTableApt.ClearBeforeFill = True
        FacultyTableApt.FillByFacultyName(CSE_DEPTDataSet.Faculty, ComboName.Text)

        If CSE_DEPTDataSet.Faculty.Count = 0 Then
            MessageBox.Show("No matched faculty found!")
            Exit Sub
        End If

    End Sub
    Private Function FindName(ByVal fName As String) As String
        Dim strName As String

        Select Case fName
            Case "Black Anderson"
                strName = "Anderson.jpg"
            Case "Ying Bai"
                strName = "Bai.jpg"
            Case "Satish Bhalla"
                strName = "Satish.jpg"
            Case Is = "Steve Johnson"
                strName = "Johnson.jpg"
            Case Is = "Jenney King"
                strName = "King.jpg"
            Case "Alice Brown"
                strName = "Brown.jpg"
            Case Is = "Debby Angles"
                strName = "Angles.jpg"
            Case Is = "Jeff Henry"
                strName = "Henry.jpg"
            Case Else
                strName = "No Match"
        End Select
        Return strName
    End Function

    Private Sub cmdBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdBack.Click
        Me.Close()
    End Sub
End Class