Public Class frmMain

    Public sAppPath As String = Application.StartupPath

    Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
        LoadParameters()

        btnMenu.PerformClick()
    End Sub

    Private Sub btnMenu_Click(sender As Object, e As EventArgs) Handles btnMenu.Click, btnEmpfaenger.Click
        btnMenu.BackColor = Color.White
        btnEmpfaenger.BackColor = Color.White

        Dim bigbut As Button = sender
        bigbut.BackColor = Color.LightBlue
        PanMain.Controls.Clear()

        Select Case sender.name
            Case "btnMenu"
                Dim usrcntrl As New usrcntlMittagsmenues : usrcntrl.Dock = DockStyle.Fill : PanMain.Controls.Add(usrcntrl)
            Case "btnEmpfaenger"
                Dim usrcntrl As New usrcntlVerteiler : usrcntrl.Dock = DockStyle.Fill : PanMain.Controls.Add(usrcntrl)
        End Select

    End Sub

    Private Function LoadParameters()
        Dim lines = IO.File.ReadAllLines(sAppPath & "\start.ini")
        Dim colCount = lines.First.Split(";"c).Length

        Dim HintergrundBild(4) As String

        For Each line In lines
            Dim objFields = From field In line.Split(";"c)

            Select Case objFields(0).ToString
                Case "DBConnection"
                    cListe.selectDBConnection(objFields(1).ToString)
                Case "PDFUploadPath"
                    cListe.PDFUploadPath = objFields(1).ToString

                Case "Design"
                    HintergrundBild = {objFields(1).ToString, objFields(2).ToString, objFields(3).ToString, objFields(4).ToString}
                    cListe.Hintergrund.Add(HintergrundBild)
            End Select

        Next

    End Function

End Class