Hallo zusammen,
Ich hänge an einen Probelm.
Ich Lese einen Text Datei ein und will den Fortschritt anzeigen.
Die Progressbar läuft, Ich möchte aber auch eine Beschriftung hinzufügen.
Ich habe die max Anzahl der Zeilen ermittelt, übergebe sie an ein Label Feld. ==> Dies wird aber nicht angezeigt.
Ich Zähle hoch und übergebe es auch an Label Feld ==> Dies wird aber nicht angezeigt.
hat jemand einen Tipp für mich?
Ich hänge an einen Probelm.
Ich Lese einen Text Datei ein und will den Fortschritt anzeigen.
Die Progressbar läuft, Ich möchte aber auch eine Beschriftung hinzufügen.
Ich habe die max Anzahl der Zeilen ermittelt, übergebe sie an ein Label Feld. ==> Dies wird aber nicht angezeigt.
Ich Zähle hoch und übergebe es auch an Label Feld ==> Dies wird aber nicht angezeigt.
hat jemand einen Tipp für mich?
VB.NET-Quellcode
- Option Strict On
- Imports System.Data.OleDb
- Public Class Form1
- Dim tcts_lfd As Integer
- Dim anzahl_zeile As String
- Dim i As Integer
- Dim DB As String
- Dim con As New OleDbConnection
- Dim cmd As New OleDbCommand
- Dim reader As OleDbDataReader
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- ' Variable bei Formular deklarieren
- 'Datenbank Test
- DB = "C:\DB\"
- 'Datenbank live
- 'DB = "N:\Datenbanken\"
- End Sub
- Sub ermitteln_hoechste_lfd()
- con.ConnectionString =
- "Provider=Microsoft.ACE.OLEDB.12.0;" &
- "Data Source=" & DB & "dbminastabellen.accdb"
- cmd.Connection = con
- Try
- con.Open()
- cmd.CommandText = "select max(lfd) as tcts_lfd from tabtabellen where NAME ='TCTS' "
- reader = cmd.ExecuteReader()
- reader.Read()
- tcts_lfd = CInt(reader("tcts_lfd"))
- reader.Close()
- tcts_lfd = tcts_lfd + 1
- 'MsgBox("Es wurden die Zahl " & Ergebnis_clu_max_wtbp & " ermittelt")
- con.Close()
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- End Sub
- Private Sub cmd_einlesen_total_Click(sender As Object, e As EventArgs) Handles cmd_einlesen_total.Click
- con.ConnectionString =
- "Provider=Microsoft.ACE.OLEDB.12.0;" &
- "Data Source=" & DB & "dbminastabellen.accdb"
- cmd.Connection = con
- con.Open()
- Try
- Dim Pat As String = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "C:\TCTS\TOTAL-Stationsliste_WEAT6.txt")
- anzahl_zeile = CStr(System.IO.File.ReadAllLines(Pat).Count)
- ProgressBar1.Minimum = 0
- '***************************************************************************************************************
- 'HIER IST MEIN PROBLEM
- ProgressBar1.Maximum = CInt(anzahl_zeile)
- '***************************************************************************************************************
- Dim sr As New System.IO.StreamReader("C:\TCTS\TOTAL-Stationsliste_WEAT6.txt")
- Dim wert03 As String
- Dim wert03_conv As Double
- Dim tcts_count As Integer
- Dim kundenr As Double
- Dim name_lfd As String
- Dim Insert_Ergebnis As Integer
- Dim Update_Ergebnis As Integer
- Dim Insert_Ergebnis_NEW As Integer
- Dim Update_Ergebnis_NEW As Integer
- Dim Zeileninhalt As String
- Dim Arr() As String
- kundenr = 1234
- Do While Not sr.EndOfStream
- Zeileninhalt = sr.ReadLine()
- Arr = Zeileninhalt.Split(CChar(";"))
- wert03 = Arr(0)
- i = i + 1
- '***************************************************************************************************************
- 'PROBLEM 2 hier übergebe ich den Wert der hochzählen dieser wird auch nicht angezeigt im Label Feld
- lbl_progress_value.Text = i
- '***************************************************************************************************************
- ProgressBar1.Value = i
- If (wert03 = "" Or Not IsNumeric(wert03)) Then
- Else
- wert03_conv = CDbl(wert03)
- 'MessageBox.Show("Die Nummer lautet: " & wert03)
- cmd.CommandText = "select count(wert03) as tcts_wert03 from tabtabellen where NAME ='TCTS' and wert03= " & wert03_conv
- reader = cmd.ExecuteReader()
- reader.Read()
- tcts_count = CInt(reader("tcts_wert03"))
- reader.Close()
- If tcts_count = 0 Then
- cmd.CommandText = "select max(lfd) as tcts_lfd from tabtabellen where NAME ='TCTS' "
- reader = cmd.ExecuteReader()
- reader.Read()
- tcts_lfd = CInt(reader("tcts_lfd"))
- reader.Close()
- tcts_lfd = tcts_lfd + 1
- name_lfd = "TCTS" & tcts_lfd
- cmd.CommandText = "INSERT INTO tabtabellen (NAME, LFD, WERT01, WERT02, WERT03, NAME_LFD) values ('TCTS'," & tcts_lfd & " , " & kundenr & ", 0, " & wert03 & ",'" & name_lfd & "')"
- Insert_Ergebnis = cmd.ExecuteNonQuery()
- Insert_Ergebnis_NEW = Insert_Ergebnis_NEW + 1
- 'name =TCTS
- 'lfd = ermitteln
- 'wert01 = Kundnummer
- 'wert02 = 0
- 'wert03 = TCS
- ' Name_lfd = Text TCTS2102
- Else
- cmd.CommandText = "update tabtabellen set wert01=" & kundenr & " where wert03=" & wert03
- Update_Ergebnis = cmd.ExecuteNonQuery()
- Update_Ergebnis_NEW = Update_Ergebnis_NEW + 1
- End If
- End If
- Loop
- MessageBox.Show("Fertig mit " & Insert_Ergebnis_NEW & " Eintragungen und " & Update_Ergebnis_NEW & " Fehlerkorekturen")
- ProgressBar1.Value = 0
- lbl_progress_max.Text = ""
- lbl_progress_value.Text = ""
- con.Close()
- sr.Close()
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- End Try
- End Sub
- End Class