+ Reply to Thread
Results 1 to 2 of 2

Multipage Control Pages - Changing Index Value in Code

Hybrid View

  1. #1
    misseill
    Guest

    Multipage Control Pages - Changing Index Value in Code

    I have a multipage control, mpManyTabs, and an array, strTabNames. I
    want the pages in mpManyTabs to be indexed in the order determined by
    the array's entries. All of the pages have captions that correspond to
    an entry in the array. I am able to cycle through the pages, look at
    the caption and see if it matches my array entry. If it does, I'd like
    to change the matching page's index to be the array's index. Can I do
    that in code? The line

    mpManyTabs.Pages(lngPages).index = lngCount-1

    below is giving me trouble.

    Private Sub ShuffleTabs(strTabNames() As String)

    Dim lngCount As Long
    Dim strTabName As String
    Dim lngPages As Long

    For lngCount = 1 To UBound(strTabNames)
    'cycle through mpManyTabs.Pages, until you find the caption
    'that is the same as strTabNames(lngcount)
    For lngPages = 0 To mpManyTabs.Pages.Count - 1
    If mpManyTabs.Pages(lngPages).Caption = strTabNames(lngCount)
    Then
    'Index starts at zero. subtract one!
    mpManyTabs.Pages(lngPages).index = lngCount-1
    Exit For
    End If
    Next lngPages
    Next lngCount

    End Sub

    I appreciate your help in advance, and I hope I was clear enough!


  2. #2
    Tom Ogilvy
    Guest

    Re: Multipage Control Pages - Changing Index Value in Code

    Your code worked fine for me. strTabNames had a lowerbound of 1.

    --
    Regards,
    Tom Ogilvy

    "misseill" <misseill@gmail.com> wrote in message
    news:1121267657.475149.243660@g47g2000cwa.googlegroups.com...
    > I have a multipage control, mpManyTabs, and an array, strTabNames. I
    > want the pages in mpManyTabs to be indexed in the order determined by
    > the array's entries. All of the pages have captions that correspond to
    > an entry in the array. I am able to cycle through the pages, look at
    > the caption and see if it matches my array entry. If it does, I'd like
    > to change the matching page's index to be the array's index. Can I do
    > that in code? The line
    >
    > mpManyTabs.Pages(lngPages).index = lngCount-1
    >
    > below is giving me trouble.
    >
    > Private Sub ShuffleTabs(strTabNames() As String)
    >
    > Dim lngCount As Long
    > Dim strTabName As String
    > Dim lngPages As Long
    >
    > For lngCount = 1 To UBound(strTabNames)
    > 'cycle through mpManyTabs.Pages, until you find the caption
    > 'that is the same as strTabNames(lngcount)
    > For lngPages = 0 To mpManyTabs.Pages.Count - 1
    > If mpManyTabs.Pages(lngPages).Caption = strTabNames(lngCount)
    > Then
    > 'Index starts at zero. subtract one!
    > mpManyTabs.Pages(lngPages).index = lngCount-1
    > Exit For
    > End If
    > Next lngPages
    > Next lngCount
    >
    > End Sub
    >
    > I appreciate your help in advance, and I hope I was clear enough!
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1