以另一种形式更改标签的值

时间:2016-11-17 22:08:45

标签: vb.net visual-studio

我需要计算另一个表单ListBox中所有值的折扣金额,然后在折扣表单和主表单中打印该值。

折扣表格代码:

Private Sub btnCalculateVisit_Click(sender As Object, e As EventArgs) Handles btnCalculateVisit.Click

    Dim dblVisits As Double = 0

    If (IsNumeric(txtVisits.Text)) Then

        If txtVisits.Text >= 0 And txtVisits.Text <= 3 Then
            dblVisits = (dblVisitRates(0) * GlobalVariables.price)

        ElseIf txtVisits.Text >= 4 And txtVisits.Text <= 8 Then
            dblVisits = (dblVisitRates(1) * GlobalVariables.price)

        ElseIf txtVisits.Text >= 9 And txtVisits.Text <= 13 Then
            dblVisits = (dblVisitRates(2) * GlobalVariables.price)

        ElseIf txtVisits.Text >= 14 And txtVisits.Text <= 1000000 Then
            dblVisits = (dblVisitRates(3) * GlobalVariables.price)

        End If

    End If

    lblDiscountAmount.Text = "$" + dblVisits.ToString

End Sub

Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click

    Dim main As New MainForm()

    main.lblDisRate.Text = GlobalVariables.dblType.ToString

    Me.Close()

End Sub

计算打印在折扣表单上,但不会更改主表单中的标签。我该怎么做?

1 个答案:

答案 0 :(得分:0)

使用caption属性尝试并对表单进行刷新。

?[`table;enlist (=;enlist `giving_type;`type);0b;()]