Standarddrucker
This commit is contained in:
@@ -45,36 +45,39 @@ Public Class frmWechselStandarddrucker
|
||||
Private Function changetxtFileForPrinter(printerFile As String) As Boolean
|
||||
|
||||
Dim changed As Boolean = False
|
||||
Try
|
||||
If File.Exists(printerFile) Then
|
||||
Dim l = IO.File.ReadAllLines(printerFile, System.Text.Encoding.Default)
|
||||
If l.Count > 0 Then
|
||||
If Not String.IsNullOrWhiteSpace(cboDefaultprinter._value) Then
|
||||
Dim lines As List(Of String) = IO.File.ReadAllLines(printerFile).ToList
|
||||
For index As Integer = 0 To lines.Count - 1
|
||||
If lines(index).ToLower.StartsWith("printer") Then
|
||||
lines(index) = String.Concat("PRINTER:", cboDefaultprinter._value)
|
||||
changed = True
|
||||
End If
|
||||
Next
|
||||
If changed Then IO.File.WriteAllLines(printerFile, lines.ToArray)
|
||||
End If
|
||||
|
||||
If Not String.IsNullOrWhiteSpace(cboDefaultprinterBON._value) Then
|
||||
Dim lines As List(Of String) = IO.File.ReadAllLines(printerFile).ToList
|
||||
For index As Integer = 0 To lines.Count - 1
|
||||
If lines(index).ToLower.StartsWith("bon") Then
|
||||
lines(index) = String.Concat("BON:", cboDefaultprinterBON._value)
|
||||
changed = True
|
||||
End If
|
||||
Next
|
||||
If changed Then IO.File.WriteAllLines(printerFile, lines.ToArray)
|
||||
End If
|
||||
|
||||
If File.Exists(printerFile) Then
|
||||
Dim l = IO.File.ReadAllLines(printerFile, System.Text.Encoding.Default)
|
||||
If l.Count > 0 Then
|
||||
If Not String.IsNullOrWhiteSpace(cboDefaultprinter._value) Then
|
||||
Dim lines As List(Of String) = IO.File.ReadAllLines(printerFile).ToList
|
||||
For index As Integer = 0 To lines.Count - 1
|
||||
If lines(index).ToLower.StartsWith("printer") Then
|
||||
lines(index) = String.Concat("PRINTER:", cboDefaultprinter._value)
|
||||
changed = True
|
||||
End If
|
||||
Next
|
||||
If changed Then IO.File.WriteAllLines(printerFile, lines.ToArray)
|
||||
End If
|
||||
|
||||
If Not String.IsNullOrWhiteSpace(cboDefaultprinterBON._value) Then
|
||||
Dim lines As List(Of String) = IO.File.ReadAllLines(printerFile).ToList
|
||||
For index As Integer = 0 To lines.Count - 1
|
||||
If lines(index).ToLower.StartsWith("bon") Then
|
||||
lines(index) = String.Concat("BON:", cboDefaultprinterBON._value)
|
||||
changed = True
|
||||
End If
|
||||
Next
|
||||
If changed Then IO.File.WriteAllLines(printerFile, lines.ToArray)
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
Return changed
|
||||
Return changed
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user