diff --git a/Aviso/frmWechselStandarddrucker.vb b/Aviso/frmWechselStandarddrucker.vb index 6df8e26..8e4a58b 100644 --- a/Aviso/frmWechselStandarddrucker.vb +++ b/Aviso/frmWechselStandarddrucker.vb @@ -32,8 +32,11 @@ Public Class frmWechselStandarddrucker VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD = cboDefaultprinter._value VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_BON = cboDefaultprinterBON._value - - SetDefaultPrinter(cboDefaultprinter._value) + Try + SetDefaultPrinter(cboDefaultprinter._value) + Catch ex As Exception + MsgBox(ex.Message) + End Try For Each path As String In filePathListOfPrinters changetxtFileForPrinter(path) @@ -82,23 +85,25 @@ Public Class frmWechselStandarddrucker End Function Private Sub getCurrentPrintersFromFile(printerFile As String) + Try + If File.Exists(printerFile) Then + Dim l = IO.File.ReadAllLines(printerFile, System.Text.Encoding.Default) + If l.Count > 0 Then + For Each li In l + If li.StartsWith("BON:") Then + VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_BON = (li.Replace("BON:", "")).Trim + End If + If li.StartsWith("PRINTER:") Then + VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD = (li.Replace("PRINTER:", "")).Trim - If File.Exists(printerFile) Then - Dim l = IO.File.ReadAllLines(printerFile, System.Text.Encoding.Default) - If l.Count > 0 Then - For Each li In l - If li.StartsWith("BON:") Then - VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_BON = (li.Replace("BON:", "")).Trim - End If - If li.StartsWith("PRINTER:") Then - VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD = (li.Replace("PRINTER:", "")).Trim - - End If - Next + End If + Next + End If End If - End If - + Catch ex As Exception + MsgBox(ex.Message) + End Try End Sub