Pergunta

How do i write a program that square the value in the textbox and add it in the listbox each time the button is click. from 0 to 100000. thanks This is what I have so far Public Class 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

End Class

Foi útil?

Solução

Here's another way to do this, hope this helps:

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
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top