我是初学者所以请你好。我在Visual Basic中制作货币兑换计算器,我遇到了一个我似乎无法弄清楚的错误:
以下是我正在努力解决的代码:
Dim Currency As Double
Dim TextOther As String = Othertext.Text
Dim TextGBP As String = GBPtext.Text
Private Sub Calculate_Click(sender As Object, e As EventArgs) Handles Calculate.Click
TextOther = Currency * Convert.ToDouble(TextGBP)
TextGBP = Currency * Convert.ToDouble(TextOther)
End Sub
提前谢谢。
答案 0 :(得分:1)
您需要将货币设置为某种内容并使用' .text。之后(我假设是)你的文本框。
还可以在点击事件中设置变量。
Dim Currency As Double
Dim TextOther As String
Dim TextGBP As String
Private Sub Calculate_Click(sender As Object, e As EventArgs) Handles Calculate.Click
currency = 10.0
TextOther = Othertext.Text
TextGBP = GBPtext.Text
TextOther.text = Currency * Convert.ToDouble(TextGBP)
TextGBP.text = Currency * Convert.ToDouble(TextOther)
End Sub