From 7c87228bff94706dda4c4a9d98a7a90c7fe9598b Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Fri, 25 Nov 2022 11:55:33 +0100 Subject: [PATCH] Standarddrucker --- Aviso/frmWechselStandarddrucker.vb | 37 +++++++++++++++++------------- 1 file changed, 21 insertions(+), 16 deletions(-) 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