Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7558385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:21:30+00:00 2026-05-30T12:21:30+00:00

So I have a bunch of listboxes on my VB form. I created a

  • 0

So I have a bunch of listboxes on my VB form. I created a command button too.

I want to make it so that if I press the command button it cycles from the current listbox, which has focus, to the previous listbox. It’s the equivalent of using TAB and SHIFT TAB to cycle amongst the control. SHIFT TAB goes backwards in the cycle, TAB goes forward in the cycle. I vaguely remember there was a way to go back & forth in the “tab cycle”.

How do I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:21:32+00:00Added an answer on May 30, 2026 at 12:21 pm

    You can;

    Private mCurrentListboxTabIndex As Integer
    
    'wire up, simpler if you use a control array
    Private Sub List1_GotFocus()
        mCurrentListboxTabIndex = List1.TabIndex
    End Sub
    
    Private Sub List2_GotFocus()
        mCurrentListboxTabIndex = List2.TabIndex
    End Sub
    
    Private Sub List3_GotFocus()
        mCurrentListboxTabIndex = List3.TabIndex
    End Sub
    
    Private Sub btnPrev_Click()
        FocusListBoxByTabIndex -1
    End Sub
    
    Private Sub btnNext_Click()
        FocusListBoxByTabIndex 1
    End Sub
    
    Private Sub FocusListBoxByTabIndex(offset As Long)
        Dim ctrl As VB.Control
        For Each ctrl In Me
            If TypeOf ctrl Is ListBox Then
                If ctrl.TabIndex = mCurrentListboxTabIndex + offset Then
                    ctrl.SetFocus
                    Exit Sub
                End If
            End If
        Next
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have bunch of PHP Scripts that require execution on press of a button
I have bunch of web document and want to remove the html tags from
I have a listbox that contains a bunch of file downloads, i want to
I want to display a bunch of Objects i have created in a ListBox.
I have a bunch of files in a folder checked out from a repository.
I have a bunch of html files that come with my app and are
I have a bunch of code in a routine that looks a bit like
I have a bunch of strings that are dependent on static dictionaries and each
I have a bunch of buttons that have a tapGestureRecognizer linked to them, and
Is it possible to make a listbox that lists a bunch of custom controls?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.