Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27513

VS 2010 Up and Down Button

$
0
0
Hello to all, I have another problem with my project. I have one TextBox and two buttons, one is for up, second is for down. So when you click on up button, the number in textbox increase for 1 and reverse, when you click on down button, number on textbox go down for 1.

here is code that I use:

Code:

    Private Sub RaUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RaUP.Click
        Static up_number As Integer
        up_number += 1
        TextBox1.Text = up_number.ToString
    End Sub

    Private Sub RaDOWN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RaDOWN.Click
        Static down_number As Integer
        down_number -= 1
        TextBox1.Text = down_number.ToString
    End Sub

Problem with this code is, that when I click up - it works, it start with one, then two etc. But when I click down it begins with 0 and then -1, -2 etc.

What should I do, that it will when I for example go to number 10 then if I click to down B. number in TB goes to 9 and if I click again on up B. it goes from 9 again to 10...

:ehh:

Realy thanks for any idea...

Viewing all articles
Browse latest Browse all 27513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>