I've created a very simple asp.net web page for generating some HTML. The idea is that each time the user clicks the button previous inputs gets stored into an array and is then listed together with the most recent input. The problem is that the array resets for each clicks, the same goes for the counter I've made (using "i" as integer and "i += 1" for each click.)
The result is that Case 0 is chosen every time, which of course isn't the plan.
Provided is the code. In advance, thanks.
Partial Class _Default
Inherits System.Web.UI.Page
Dim name, url, dive As String
Dim i As Integer
Dim rememberme(2) As String
Protected Sub btn_readmetoo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_readmetoo.Click
name = txt_name.Text
url = txt_url.Text
If i = 3 Then
i = 0
End If
Select Case i
Case 0
rememberme(0) = "Les også: " & "<a href=""" & url & """" & ">" & name & "</a>"
txt_listurls.Text = "<p>" & rememberme(0) & "</p>"
Case 1
rememberme(1) = "Les også: " & "<a href=""" & url & """" & ">" & name & "</a>"
txt_listurls.Text = "<p><ul><li>" & rememberme(0) & "<li>" & rememberme(1) & "</ul></p>"
Case 2
rememberme(2) = "Les også: " & "<a href=""" & url & """" & ">" & name & "</a>"
txt_listurls.Text = "<p><ul><li>" & rememberme(0) & "<li>" & rememberme(1) & "<li>" & rememberme(2) & "</ul></p>"
End Select
i += 1
lbl_counter.Text = i
End Sub