Solved

Multiple Function Controls

Posted on 2003-12-04
5
176 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
  • 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 125 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Vlookup to move data back to source. 4 90
MsgBox 4 59
VB 6 error 5 in windows 10 but not in XP 7 55
Advice in Xamarin 21 78
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

815 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now