VB 2010 を使用して問題が発生しました。3 つのラジオ ボタンのうちの 1 つの選択に基づいて、カーペットのコストを計算しようとしています。
フォームの上部にこれがあります:
Private CarpetPrice, UnderlayPrice As Decimal
ここにボタンクリックのコードがあります
Private Sub CostButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CostButton.Click
' Calculate button click
' Radio Button IF Statement for calculating cost
If EconomyRadioButton.Checked Then
UnderlayPrice = 3.95 And CarpetPrice = 12.95
ElseIf DeluxeRadioButton.Checked Then
UnderlayPrice = 4.95 And CarpetPrice = 15.49
ElseIf PlushRadioButton.Checked Then
UnderlayPrice = 5.95 And CarpetPrice = 19.95
End If
' Start Calculations
CarpetNumLabel.Text = (((Length1TextBox.Text * Width1TextBox.Text) / 1296) + ((Length2TextBox.Text * Width2TextBox.Text) / 1296) + _
((Length3TextBox.Text * Width3TextBox.Text) / 1296) + ((HallLengthTextBox.Text * HallWidthTextBox.Text) / 1296)) * 1.05
UnderlayNumLabel.Text = CarpetNumLabel.Text
TackNumLabel.Text = ((Length1TextBox.Text / 96) + (Width1TextBox.Text / 96) + (Length2TextBox.Text / 96) + (Width2TextBox.Text / 96) _
+ (Length3TextBox.Text / 96) + (Width3TextBox.Text / 96) + (HallLengthTextBox.Text / 96) + (HallWidthTextBox.Text / 96)) * 1.1
ScrewNumLabel.Text = ((TackNumLabel.Text / 1.1) * 8) / 50
CarpetCostLabel.Text = CarpetNumLabel.Text * CarpetPrice
UnderlayCostLabel.Text = UnderlayNumLabel.Text * UnderlayPrice
TackCostLabel.Text = TackNumLabel.Text
ScrewCostLabel.Text = ScrewNumLabel.Text * 2.85
End Sub
現在、カーペットと下敷きが価格を計算していないことを除いて、すべてが完璧に動作しています. ボタンをクリックしたときにラジオ ボタンのステータスをプログラムに認識させるには、他に何かする必要がありますか? -
私の問題は次の場所にあると思います:
CarpetCostLabel.Text = CarpetNumLabel.Text * CarpetPrice
UnderlayCostLabel.Text = UnderlayNumLabel.Text * UnderlayPrice
助けてくれてありがとう。