Hi, I’m trying to increment a number each time the user click on a button. My code happens to be in a button that is a Public Shared sub. Because it is a public shared, I can’t access the query string in the usual manner like this:
Response.Redirect("default.aspx?question=1")
Dim num As String = Request.QueryString("question")
So I can’t use the Query String to increment my number.
The other trick I tried is to create a public class and set the number in that class. I then retrieve the number back from the class and try to increment it but each time I click on the button, the number resets to the original and does not increment. Here’s what the code looks like.
objNewNumber.QuestionChanged = newNumber
newNumber = newNumber + 1
qDetails = QuestionCatalog.GetQuestion(newNumber)
TheQuestion.lblTheQuestion.Text = qDetails.Question
That last piece of code may be a bit confusing but in short, all I want to do is to increment a number each time a user click on my button that is a Public Shared sub.
Response.Redirect("default.aspx?question=1")
Dim num As String = Request.QueryString("question")
So I can’t use the Query String to increment my number.
The other trick I tried is to create a public class and set the number in that class. I then retrieve the number back from the class and try to increment it but each time I click on the button, the number resets to the original and does not increment. Here’s what the code looks like.
objNewNumber.QuestionChanged = newNumber
newNumber = newNumber + 1
qDetails = QuestionCatalog.GetQuestion(newNumber)
TheQuestion.lblTheQuestion.Text = qDetails.Question
That last piece of code may be a bit confusing but in short, all I want to do is to increment a number each time a user click on my button that is a Public Shared sub.