如何编写一个程序,使文本框中的值平方,并在每次单击按钮时将其添加到列表框中。从0到100000.谢谢 这就是我到目前为止所拥有的 公共类frmSquare
Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
Dim x As Double
Dim number As Double = txtNumber.Text
lstSquare.Items.Add(number * number)
x = number
End Sub
Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
Me.Close()
End Sub
结束班
答案 0 :(得分:0)
这是另一种方法,希望这会有所帮助:
If IsNumeric(TextBox1.Text) Then
Dim dbl As Double = CDbl(TextBox1.Text)
dbl *= dbl
ListBox2.Items.Add(dbl)
Else
MessageBox.Show("Value entered is not a Number")
End If