Need to be able for buttons to keep track of each other

Discussion in 'ASP General' started by bob, May 3, 2004.

  1. bob

    bob Guest

    I am just getting into web programming. I am using VB ASP.NET. I have
    multiple buttons on my form.
    When a person clicks on one of imgagebuttons, I want a accumulated counter
    for each time a button is clicked, and when 2 different imagebuttons are
    clicked, I want them compared to see if the images are the same, how do I do
    this? I tried making the variables public, but I think I am having problems
    with viewstate in which I am not using besides the property being true.

    TIA
    ..
    Here the code behind one of the buttons:

    ncount += 1 'this is suppose to count how many buttons are pushed.

    If ncount < 3 Then

    ImageButton2.ImageUrl = newimage

    Select Case ncount

    Case 1

    b(1) = ImageButton2.ImageUrl

    Case 2

    b(2) = ImageButton2.ImageUrl

    ncount = 0 ' reset the count because only 1 or 2 buttons_

    'be pushed at 1 time.

    If b(1) = b(2) Then

    'Messagebox("Correct")

    correct += 1

    lblNumberCorrect.Text = Str(correct)

    lblifCorrect.Text = "Correct"

    Else

    incorrect += 1

    lblNumberIncorrect.text = Str(incorrect)

    lblifcorrect.Text = "InCorrect"

    End If

    ncount = 0

    End Select

    End If
     
    bob, May 3, 2004
    #1
    1. Advertising

  2. >I am just getting into web programming. I am using VB ASP.NET.

    This newsgroup is for classic ASP. Please see a .NET newsgroup. They have
    "dotnet" in their name.

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/
     
    Aaron Bertrand [MVP], May 3, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Q.Z
    Replies:
    1
    Views:
    363
    bruce barker
    Jan 7, 2004
  2. bob
    Replies:
    1
    Views:
    317
    Natty Gur
    May 3, 2004
  3. gce
    Replies:
    5
    Views:
    530
    Scott Allen
    Mar 16, 2005
  4. Alan Wang

    Keep track of Session value

    Alan Wang, Oct 28, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    437
    Peter Rilling
    Oct 28, 2005
  5. Melissa Mussitsch

    .NET able to track file download success?

    Melissa Mussitsch, Feb 19, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    285
    Alessandro Zifiglio
    Feb 19, 2004
Loading...

Share This Page