G
Guest
Can someone tell me why my integer variable _arrCnt is not holding its value.
I’m using ASP 2.0. I’m trying to use it in a public property routine to
count for my array. It keeps coming back with a 0 value instead of
incrementing.
Code sample from mainscreen.aspx
Partial Class mainscreen
Inherits System.Web.UI.Page
Dim clscmp As New clsCmpSetup
Dim arrStatement(10, 1)
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Dim i As Integer
Dim bisTrue As Boolean = False
If Not bisTrue Then
ddlStatements.Items.Add(txtTitle.Text)
arrStatement(clscmp.ArrCnt, 0) = txtTitle.Text
arrStatement(clscmp.ArrCnt, 1) = txtStatements.Text
clscmp.ArrCnt = 1
End If
END SUB
Code sample from clsCmpSetup:
Imports Microsoft.VisualBasic
Public Class clsCmpSetup
Dim _arrCnt As Integer
Public Property ArrCnt() As Integer
Get
Return _arrCnt
End Get
Set(ByVal value As Integer)
If value < 0 Then
_arrCnt = 0
Else
_arrCnt = _arrCnt + 1
End If
End Set
End Property
End Class
I’m using ASP 2.0. I’m trying to use it in a public property routine to
count for my array. It keeps coming back with a 0 value instead of
incrementing.
Code sample from mainscreen.aspx
Partial Class mainscreen
Inherits System.Web.UI.Page
Dim clscmp As New clsCmpSetup
Dim arrStatement(10, 1)
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Dim i As Integer
Dim bisTrue As Boolean = False
If Not bisTrue Then
ddlStatements.Items.Add(txtTitle.Text)
arrStatement(clscmp.ArrCnt, 0) = txtTitle.Text
arrStatement(clscmp.ArrCnt, 1) = txtStatements.Text
clscmp.ArrCnt = 1
End If
END SUB
Code sample from clsCmpSetup:
Imports Microsoft.VisualBasic
Public Class clsCmpSetup
Dim _arrCnt As Integer
Public Property ArrCnt() As Integer
Get
Return _arrCnt
End Get
Set(ByVal value As Integer)
If value < 0 Then
_arrCnt = 0
Else
_arrCnt = _arrCnt + 1
End If
End Set
End Property
End Class