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

        ComboName.Items.Add("Erica Johnson")
        ComboName.Items.Add("Ashly Jade")
        ComboName.Items.Add("Holes Smith")
        ComboName.Items.Add("Andrew Woods")
        ComboName.Items.Add("Blue Valley")
        ComboName.SelectedIndex = 0
    End Sub

    Private Sub cmdSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSelect.Click
        Dim StudentTableApt As New CSE_DEPTDataSetTableAdapters.StudentTableAdapter
        Dim StudentCourseTableApt As New CSE_DEPTDataSetTableAdapters.StudentCourseTableAdapter
        Dim strName As String

        strName = FindName(ComboName.Text)
        If strName = "No Match" Then
            MessageBox.Show("No Matched Student Found!")
            Exit Sub
        End If
        PhotoBox.SizeMode = PictureBoxSizeMode.StretchImage
        PhotoBox.Image = System.Drawing.Image.FromFile(strName)
        StudentTableApt.ClearBeforeFill = True
        StudentTableApt.FillByStudentName(CSE_DEPTDataSet.Student, ComboName.Text)
        If CSE_DEPTDataSet.Student.Count = 0 Then
            MessageBox.Show("No matched student found!")
            Exit Sub
        End If
        StudentCourseTableApt.ClearBeforeFill = True
        StudentCourseTableApt.FillByStudentID(CSE_DEPTDataSet.StudentCourse, txtID.Text)

    End Sub

    Private Function FindName(ByVal sName As String) As String
        Dim strName As String

        Select Case sName
            Case "Erica Johnson"
                strName = "Erica.jpg"
            Case "Ashly Jade"
                strName = "Ashly.jpg"
            Case "Holes Smith"
                strName = "Holes.jpg"
            Case Is = "Andrew Woods"
                strName = "Andrew.jpg"
            Case Is = "Blue Valley"
                strName = "Blue.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