Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Vb.NET] Streamreader ließt letzte Zeile nichtmehr

Empfohlene Antworten

Guten Morgen,

folgende Problemstellung:

Ich habe eine Klasse, welche ihre Settings aus mehreren *.lst files ließt.

Gestern Abend war auch noch alles in Ordnung. Als ich gerade eben weitere Einträge in eine der *.lst Dateien tätigte, ließt das Programm immer nur bis zur Vorletzten Zeile. Ich kann mir das Phänomen nicht erklären.

Das ist die Funktion welche für das auslesen zuständig ist:


 Private Function loadExclMarks() As DataTable()

        Dim dt(2) As DataTable

        dt(0) = New DataTable

        dt(0).TableName = "DBS"

        dt(0).Columns.Add("pr32")

        dt(0).Columns.Add("Usage")

        dt(1) = New DataTable

        dt(1).TableName = "ExcelMarks"

        dt(1).Columns.Add("pr32")

        dt(1).Columns.Add("Usage")

        dt(2) = New DataTable

        dt(2).TableName = "TableSettings"

        dt(2).Columns.Add("pr32")

        dt(2).Columns.Add("Usage")

        Dim tmpArray() As String

        Dim hbool As Boolean = False

        Dim fbool As Boolean = False

        Dim tbool As Boolean = False


        Dim wr As New StreamReader(optfilename, False)

        Try

            Do Until wr.EndOfStream = True

                Dim line As String = wr.ReadLine()

                If line.Contains("***") Then

                    If line.Contains("DBS") Then

                        hbool = True

                        fbool = False

                        tbool = False

                    ElseIf line.Contains("ExcelMarks") Then

                        hbool = False

                        fbool = True

                        tbool = False

                    End If

                ElseIf line.Contains("OtherExcelSettingValues") Then

                    hbool = False

                    fbool = False

                    tbool = True

                Else

                    If hbool Then

                        tmpArray = line.Split("|")

                        If (tmpArray.Length = 2 And tmpArray(0).StartsWith("#") = False) Then

                            dt(0).Rows.Add(tmpArray)

                        End If

                    ElseIf fbool Then

                        tmpArray = line.Split("|")

                        If (tmpArray.Length = 2 And tmpArray(0).StartsWith("#") = False) Then

                            dt(1).Rows.Add(tmpArray)

                        End If

                    ElseIf tbool Then

                        tmpArray = line.Split("|")

                    If (tmpArray.Length = 2 And tmpArray(0).StartsWith("#") = False) Then

                            dt(2).Rows.Add(tmpArray)

                        End If

                    End If

                End If

            Loop

            wr.Close()

        Catch

            wr.Close()

        End Try

        Return dt

    End Function

Und hier ist der zugehörige File Content:

#RegionLST

#Description: Intern programm description (do not change)|DBS caption or excel caption

***DBS

Menge|Menge

Beschreibung|Beschreibung

Summe|Summe

Einzelpreis|Einzelpreis

SteuerGesamt|SteuerGesamt

AutoFormat|#.##0,00 €;-#.##0,00 €

Zwischensumme|Zwischensumme

***ExcelMarks

<<Ocdate>>|<<Ocdate>>

<<RID>>|<<RID>>

<<Otable>>|<<Otable>>

***OtherExcelSettingValues

test|test

Falls jemandem etwas auffallen sollte, wäre ich wie immer sehr erfreut :D.

Lg

Gateway

Bearbeitet von Gateway_man

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.