Imports System.IO Public Class DB_Connection Shared Sub New() Dim fc As Integer = 0 If Globals.ConnectionFileName.Length = 0 Then Dim Dir As DirectoryInfo = New DirectoryInfo(Application.StartupPath) Try Dim ChildFile As FileInfo For Each ChildFile In Dir.GetFiles() If UCase(Left(ChildFile.Name, 5)) = "EDOKA" And UCase(ChildFile.Extension) = ".CFG" Then fc = fc + 1 End If Next Catch except As Exception fc = 0 Exit Sub End Try End If If fc < 5 Then Globals.ConnectionFileName = "edokaconn.cfg" Dim ofile As System.IO.File Dim oread As System.IO.StreamReader oread = ofile.OpenText(Application.StartupPath + "\" + Globals.ConnectionFileName) sConnectionString = oread.ReadLine sConnectionString = Crypto.DecryptText(sConnectionString, "HutterundMueller") sConnectionString = Left(sConnectionString, Len(sConnectionString) - 1) Globals.sConnectionString = sConnectionString oread.Close() End Sub End Class