Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing a number to increment up or down .ASPX or class 1

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I am making a document viewer. I will be passed from 1 to 15 docs
I want a Next button to load the next document. I have the document numbers in an array
How can I move to the next doc when I click the Next button?

This is my class
Code:
    Public Class Class1
    Private mDocsArray(15) As String
    Private DocNum1 As Integer

    Public Sub New()

    End Sub


    Property ParseDocs() As String()
        Get
            Return mDocsArray
        End Get
        Set(ByVal Value() As String)
            mDocsArray = Value
        End Set
    End Property

‘ I want to use this Property to store a number ? Or do I
    Property Docnum()
        Get
            Return DocNum1
        End Get
        Set(ByVal Value)
            DocNum1 = Value
        End Set
    End Property
End Class

This is my VB ASP.NET
Code:
   Private Sub cmdNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdNext.Click
     
Dim DocName As String
        Dim p As New Class1
        Dim AllDocs(15) As String
        p = CType(Session("p"), Class1)
        AllDocs = p.ParseDocs
        DocName = p.ParseDocs(p.Docnum)  <<<< want this to be a variable that increments up one each time this Next button is clicked.
        Me.lblFullDocName.Text = DocName + ".doc"

‘load doc 
…..

End sub

Or what ever is easiest
A global variable odes not work? As in VB.NET

TIA


DougP, MCP, A+
 
so on your button you just want to see if it's at it's max...if not do

Code:
Dim p As New Class1
p = CType(Session("p"), Class1)
if not the 15th item then
p.Docnum = p.Docnum + 1
else
p.Docnum = 0
end if


"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Fantastic !!!!!

works GREAT !!!
heres a star

also I modified it a bit
to allow it to just have and many numbers as my array
Code:
        Dim p As New Class1
        p = CType(Session("p"), Class1)
        If p.Docnum <= UBound(p.ParseDocs) Then
            p.Docnum = p.Docnum + 1
        Else
            p.Docnum = 0
        End If
        Me.lblDocNum.Text = p.Docnum

DougP, MCP, A+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top