Hallo
ich arbeite mich gerade in vb.net ein.
Jetzt habe ich hier folgendes Problem:
Ich rufe über ein Formular eine Funktion innerhalb eines Moduls auf.
Die Funktion soll ein Formular mit Progressbar anzeigen, die sich in dieser Funktion und weiteren Unterroutinen(Funktionen) aktualisieren soll.
Innerhalb der Funktion funktioniert das ja aber in den Unterroutinen nicht.
Was mache ich falsch?
Hier der Code (verkürzt):
_Dim objForm As New frmProgress()
Function fncReadStart()
System.Windows.Forms.Application.DoEvents()
objForm.Show()
…
objForm.pbaFortschritt.Value = 1
objForm.Text = „Progress: 1 %“
fncSubFolders()
objForm.pbaFortschritt.Value = 8
objForm.Text = „Progress: 8 %“
fncReadFiles()
objForm.pbaFortschritt.Value = 100
objForm.Text = „Progress: 100 %“
objForm.Close()
…
End Function
Function fncReadFiles()
…
lngCount = rstObj.RecordCount
For F = 1 To lngCount
System.Windows.Forms.Application.DoEvents()
If Not CDec(objForm.pbaFortschritt.Value) + CDec(92 / lngCount) > 100 Then
decVal = CDec(objForm.pbaFortschritt.Value) + CDec(92 / rstObj.RecordCount)
objForm.pbaFortschritt.Value = decVal
System.Windows.Forms.Application.DoEvents()
objForm.Text = „Progress: " & Format(objForm.pbaFortschritt.Value, „0.00“) & " %“
End If
…
Next
…
End Function
Function fncSubFolders() 'ByVal objForm As frmProgress)
…
do
If Not CDec(objForm.pbaFortschritt.Value) + decVal > 8 Then
objForm.pbaFortschritt.Value = CDec(objForm.pbaFortschritt.Value) + decVal
System.Windows.Forms.Application.DoEvents()
objForm.Text = „Progress: " & Format(objForm.pbaFortschritt.Value, „0.00“) & " %“
End If
…
loop
…
End Function_
Vielen Dank für die Hilfe…