none
Label控件内容更新。 RRS feed

  • 问题

  • 我要修改一个很大的表中的一个字段,我想在界面上看更新的进度。我想通过label控件来显示进度,每次修改,label要有变化,我下面的代码,只有结束,才显示。请问要怎样做才行?谢谢

    Private Sub btnUpdateHeight_Click(sender As System.Object, e As System.EventArgs) Handles btnUpdateHeight.Click
    
        dt = loadform()
    
        ProgressBarTSLabels.Minimum = 0
    
        Dim qty As Integer = 0
    
        ProgressBarTSLabels.Value = 0
    
        ProgressBarTSLabels.Maximum = dt.Rows.Count
    
        Dim db As New DataClasses1DataContext
    
        For Each Me.dr In dt.Rows
    
            If dr.Item(5).ToString.Trim <> "" Then
    
                Dim sqlupdate As tblLabel = (From expr In db.tblLabels Where expr.LabelID = dr.Item(0).ToString).First
    
                With sqlupdate
    
                    .Height = If(dr.Item(5).ToString = "max", "999", dr.Item(5).ToString)
    
                    db.SubmitChanges()
    
                End With
    
            End If
    
            ProgressBarTSLabels.Value += 1
    
            qty += 1
    
            lblQty.Text = qty & "/" & dt.Rows.Count
    
        Next
    
    End Sub

    2016年2月29日 13:04

全部回复