Help - Search - Members - Calendar
Full Version: Quick Question In Vb
OverclockersClub Forums > Operating Systems & Software Support > Programmer's Corner
l33t p1mp
Heres the code I have so far.
CODE
Public Class Form1

    Private Sub txtSide_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSide.TextChanged
        Dim side As Integer
        Dim area As Integer
        side = Val(Me.txtSide.Text)
        area = side * side
        Me.lblAnswer.Text = area
    End Sub

    Private Sub btnAnswer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAnswer.Click

    End Sub
End Class

My problem is when I type in something into my textbox, it gives the area of it immediately. What do I put into the button command to make it wait until the button is pressed for the answer to appear?
Zertz
What are you trying to do exactly?
The Smith
First it would have been great if you told us which VB language you use. Here I assume you are in .NET, but I can be wrong.

CODE
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

End Sub


Simply put the order of displaying the result in this sub. smile.gif
l33t p1mp
Its .NET, sorry, wasnt really thinking when I posted lol.
Thanks Smith.
markiemrboo
Yeah, just shift all the code from txtSide_TextChanged to btnAnswer_Click
l33t p1mp
Tried that and it doesnt display any answer when I type or press the button.
The Smith
Post your whole code as it is now. We'll try to figure out what is the problem.
suedenim
Is the button actually named btnAnswer?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.