在标签中显示数字时出现问题。 Visual Basic

时间:2018-10-23 22:37:04

标签: vb.net label

我目前正在我的大学里参加视觉基础课,我在分配给我的一项练习时遇到了麻烦。我需要显示公司的物料成本,而标签上什么也没显示。

这是代码

Option Explicit On
Option Strict On
Option Infer Off

Public Class MainForm

    Private Sub BtnCalc_Click(sender As Object, e As EventArgs) Handles BtnCalc.Click

        Dim intCost As Double

        If RadTwin.Checked Then
            intCost = 39.99
        ElseIf RadFull.Checked Then
            intCost = 49.99
        ElseIf RadQueen.Checked Then
            intCost = 49.99
        ElseIf RadKing.Checked Then
            intCost = 69.99
        End If

        lblCost.Text = intCost.ToString("n")
    End Sub

    Private Sub BtnExit_Click(sender As Object, e As EventArgs) Handles BtnExit.Click
        Me.Close()
    End Sub

    Private Sub RadTwin_CheckedChanged(sender As Object, e As EventArgs) Handles RadTwin.CheckedChanged
        lblCost.Text = String.Empty
    End Sub

    Private Sub RadFull_CheckedChanged(sender As Object, e As EventArgs) Handles RadFull.CheckedChanged
        lblCost.Text = String.Empty
    End Sub

    Private Sub RadQueen_CheckedChanged(sender As Object, e As EventArgs) Handles RadQueen.CheckedChanged
        lblCost.Text = String.Empty
    End Sub

    Private Sub RadKing_CheckedChanged(sender As Object, e As EventArgs) Handles RadKing.CheckedChanged
        lblCost.Text = String.Empty
    End Sub
End Class

选择单选按钮时,我需要在lblCost中显示每个项目的成本。我已经工作了几个小时,但是我不了解该怎么做。如果有人对如何使此代码有效有任何想法,我将不胜感激。我可能缺少一些愚蠢的简单事情,但是如果将来再次发生,我想学习如何解决这个问题。

0 个答案:

没有答案