-3
我對這個新的等,我已經擺脫了,如果你可以使一個按鈕等於一次點擊一個值。下面有什麼Iv'e得到了
的一個實例:具有價值的Visual Basic按鈕
公共類Form1中我已經使用
Private Sub BuyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BuyButton.Click
Dim MoneyBtn1 As String
Btn10p.PerformClick = MoneyBtn1
MoneyBtn1 = 0.1 + AmountTextBox.Text
Dim Cost, Amount, Change As Decimal
Dim Pennies, Pounds As Integer
Dim msg As String
Cost = Decimal.Parse(CostTextBox.Text)
Amount = Decimal.Parse(AmountTextBox.Text)
Change = (Amount - Cost)
If Change < 0 Then
msg = "You don't have enough Money"
Else
Pounds = Math.Floor(Change)
Pennies = (Change - Pounds) * 100
msg = "Your change is: " & Change.ToString("##.00") & Environment.NewLine
msg += "Pounds: " & Pounds & vbNewLine
msg += "Pennies: " & Pennies & vbNewLine
End If
ChangeLabel.Text = msg
End Sub
End Class
答: 私人小組Btn10p_Click(BYVAL發件人爲System.Object的,BYVALË作爲System.EventArgs)把手Btn10p .Click AmountTextBox.Text = AmountTextBox.Text + 0.1 End Sub
一些技巧。把你的代碼放在一個代碼塊中(突出顯示它並按下cntl + k)。此外,這是vb.net或vba?他們是不同的語言。請編輯您的問題,以便您可以從正確的人員處獲得關注。 – RubberDuck
或抵制旨在幫助您回滾的編輯。 :} – J0e3gan
謝謝,編輯。 – user3498334