Programminitialisierung beim Programmstart

Module ModInit
    Public DBCon As New NpgsqlConnection
    'Public myFrmEinsatzPlantafel As frmEinsatzPlanTafel
    Public myfrmTherapeuten As frmTherapeuten
    Public myfrmPatienten As frmPatienten
    'Public myfrmEinsaetzeErfassen As frmEinsaetzeErfassen
    'Public myfrmBewilligungBearbeiten As frmBewilligungBearbeiten

    Public DBName As String
    Public DBOdbc As String
    Public DBPort As String
    Public DBServer As String
    Public DBUserPassw As String
    Public ImportDatei As String
    Public KommeVon As String
    Public MDIBreite As Long
    Public MDIHoehe As Long
    Public MDIMenueStripHoehe As Long
    Public MDIStatusStripHoehe As Long
    Public PersonalNr As Integer
    Public PicPath As String
    Public PrgDatum As String
    Public ReportPath As String
    Public SndPath As String
    Public UeberTraeger As String
    Public UserName As String

    Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Long
    Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Long

    Public Sub ProgrammInitialisierung()

        Dim strCon As String
        Dim frm As New frmAnMeldung

        PrgDatum = Today & " " & TimeString

        IniDateiLesen("DBDATA", "Server", DBServer)
        IniDateiLesen("DBDATA", "ODBC", DBOdbc)
        IniDateiLesen("DBDATA", "DBPort", DBPort)
        IniDateiLesen("DBDATA", "Datenbank", DBName)
        IniDateiLesen("Path", "Reports", ReportPath)
        ReportPath = ReportPath ' & "\"
        IniDateiLesen("Path", "Pic", PicPath)
        PicPath = PicPath & "\"
        IniDateiLesen("Path", "Sound", SndPath)
        SndPath = SndPath & "\"

        IniDateiLesen("User", "User", UserName)

        UeberTraeger = ""

        frm.ShowDialog()

        If UeberTraeger = "END" Then Exit Sub


        IniDateiSchreiben("User", "User", UserName)

        strCon = "SERVER=" & DBServer & ";DATABASE=" & DBName & ";User Id=" & UserName & ";PASSWORD=" & UeberTraeger & ";"

        If DBServer = "" Or DBName = "" Or UserName = "" Then

            MsgBox(strCon, vbOKOnly)

        End If

        DBUserPassw = UeberTraeger

        DBCon.ConnectionString = strCon

        PersonalNr = PersonalNrHolen()

    End Sub

End Module