?
Solved

Multiple Function Controls

Posted on 2003-12-04
5
Medium Priority
?
180 Views
Last Modified: 2010-05-03
I have two buttons, "Previous" and "Next".  I have multiple textbox arrays.  What I want to do is, when you click on the "Next" button the next textbox array will show, press the "Next" button again and the nex textbox after that will show, etc.

The "Previous" button needs to do the same only in reverse.  As little coding as possible would be nice.

Thanks!
0
Comment
Question by:johnqtr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 24

Expert Comment

by:shivsa
ID: 9880159
Hi trixits,
no it not possible, the same question asked before on this many times, but answer was always no.

Cheers!
0
 
LVL 24

Expert Comment

by:shivsa
ID: 9880168
sorry for my last comment, it was for some other post.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9880857
It's probably more complicated than I think, but does approach the problem?

Private Sub cmdNext_Click()
    Dim i As Integer
    Dim bFlag As Boolean
    Dim bFlag2 As Boolean
    Const iBoxCount = 3
    'ensures that there is no more than one box visible
    Do Until i = iBoxCount
        If bFlag2 Then
            Text1(i).Visible = False
        Else
            If bFlag Then
               Text1(i).Visible = True
               bFlag2 = True
            Else
                If Text1(i).Visible Then
                    Text1(i).Visible = False
                    bFlag = True
                End If
            End If
        End If
        i = i + 1
    Loop
   
    'Restart at beginning
    If bFlag = False Or bFlag2 = False Then
        Text1(0).Visible = True
    End If

End Sub
0
 
LVL 2

Accepted Solution

by:
lttia1 earned 500 total points
ID: 9881082
Try this:

For this, you have to ensure that only 1 textbox is visible at runtime

Private Sub cmdNext_Click()
  Dim HighestIndex As Long
  Dim LowestIndex As Long
  Dim Index As Long
 
  HighestIndex = Text1.UBound
  LowestIndex = Text1.lBound
 
  For Index = LowestIndex To HighestIndex - 1
    If Text1(Index).Visible = True Then
      Text1(Index).Visible = False
      Text1(Index + 1).Visible = True
      Exit For
    End If
  Next
End Sub

Private Sub cmdPrevious_Click()
  Dim HighestIndex As Long
  Dim LowestIndex As Long
  Dim Index As Long
 
  HighestIndex = Text1.UBound
  LowestIndex = Text1.lBound
 
  For Index = HighestIndex To LowestIndex + 1 Step -1
    If Text1(Index).Visible = True Then
      Text1(Index).Visible = False
      Text1(Index - 1).Visible = True
      Exit For
    End If
  Next
End Sub
0
 
LVL 2

Expert Comment

by:lttia1
ID: 9881114
this means that except for textbox(0)(example), you have to set the rest of the textbox array visible property to false at design time
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question