J
Jan Nielsen
Hi all
I am learning Asp.Net using Vb.net (VS 2002).
I found the following example in a book:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim count As Integer
If Not Me.ViewState("Count") Is Nothing Then
count = CInt(Me.ViewState("Count")) + 1
End If
Me.ViewState("Count") = count
Label1.Text = count.ToString()
End Sub
And at first it did not work. The me.viewstate("count") property wasn't
incremented.
I then realized that I have mixed Me.ViewState("count") and
Me.ViewState("Count") . Note the capital C
And the code does not work if I mix capital and non-capital C's.
I can use
If Not Me.ViewState("Count") Is Nothing Then
count = CInt(Me.ViewState("Count")) + 1
End If
Me.ViewState("Count") = count
or
If Not Me.ViewState("count") Is Nothing Then
count = CInt(Me.ViewState("count")) + 1
End If
Me.ViewState("count") = count
But not
If Not Me.ViewState("Count") Is Nothing Then
count = CInt(Me.ViewState("Count")) + 1
End If
Me.ViewState("count") = count (Mixed C's)
I thought VB.Net was not case sensitive. Am I wrong?
Best regards
Jan
I am learning Asp.Net using Vb.net (VS 2002).
I found the following example in a book:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim count As Integer
If Not Me.ViewState("Count") Is Nothing Then
count = CInt(Me.ViewState("Count")) + 1
End If
Me.ViewState("Count") = count
Label1.Text = count.ToString()
End Sub
And at first it did not work. The me.viewstate("count") property wasn't
incremented.
I then realized that I have mixed Me.ViewState("count") and
Me.ViewState("Count") . Note the capital C
And the code does not work if I mix capital and non-capital C's.
I can use
If Not Me.ViewState("Count") Is Nothing Then
count = CInt(Me.ViewState("Count")) + 1
End If
Me.ViewState("Count") = count
or
If Not Me.ViewState("count") Is Nothing Then
count = CInt(Me.ViewState("count")) + 1
End If
Me.ViewState("count") = count
But not
If Not Me.ViewState("Count") Is Nothing Then
count = CInt(Me.ViewState("Count")) + 1
End If
Me.ViewState("count") = count (Mixed C's)
I thought VB.Net was not case sensitive. Am I wrong?
Best regards
Jan