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 7525023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:13:24+00:00 2026-05-30T03:13:24+00:00

I made a form with 10 listboxes. I want to give focus to a

  • 0

I made a form with 10 listboxes. I want to give focus to a listbox of my choosing. For example, if i choose the integer “3” it will put focus on the listbox whose tabindex = 3.

How do I do this?

I thought this might work but it doesn’t:

Dim lst As VB.ListBox: Set lst = Form.Controls(lst.TabIndex = 3)
lst.SetFocus
  • 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-30T03:13:25+00:00Added an answer on May 30, 2026 at 3:13 am

    Do you have a control array for your list boxes? If so, you can simply do this:

    YourListBoxName.Item(YourNumber).SetFocus
    

    The above code will only work properly for you if the List boxes are a control array and you have the tab indexes set in the same order that you placed the list boxes on the screen.

    Otherwise, you can try this code:

    Dim oControl As Control
    Dim YourNumber As Integer
    
    YourNumber = 4
    
    For Each oControl In Me.Controls
        If oControl.TabIndex = YourNumber Then
            oControl.SetFocus
            Exit For
        End If
    Next
    

    This code will loop through all the controls on your form and actively search for the one that matches your tab index. Once the control is found, it sets the focus to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a form subscribe form. when inserting data i will put the subscribe
I made register form where you have to put in all your personal info.
I have made a form that asks the user to put in first name
Okay. So I made a form. If I put in mysql_real_escape_string on my variable
i have a form (made through codeigniter) that i want to submit with ajax
I have made a form. I want to open a inline popup on submit
I made a form so that users can register their email address for a
I made the form partial for creating microposts as shown in Listing 10.33 with
I made a form class in c# that has a devexpress grid, a label
Basically I've made a form in Cakephp 2.1 with a jQuery button that appends

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.