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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:58:25+00:00 2026-05-25T01:58:25+00:00

VB.NET Windows Forms Project, VS2010. I have a tabcontrol with several tabpages and on

  • 0

VB.NET Windows Forms Project, VS2010.

I have a tabcontrol with several tabpages and on each tabpage there is a textbox. I want the focus (and insertion point) to go to the end of the text in the textbox when the tab is selected. If I make a junky project with the following code in each tab, it works fine:

Private Sub TabPage1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabPage1.Enter
  With TextBox1
    .SelectionStart = .Text.Length
    .Select()
  End With
End Sub

However, the same code is not working in my actual project. I am having trouble debugging, because if I step through, the breakpoints and IDE mean the focus events don’t fire in the same order. Any help to either get the result I want, or even to how to debug would be most appreciated.

  • 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-25T01:58:26+00:00Added an answer on May 25, 2026 at 1:58 am

    Print out the order of events using System.Diagnostics.Debug.Write(“FunctionName: xyz, ActiveControl selected:” & Me.ActiveControl) so you know the call stack order and which event steals the focus away. This will also help you to reproduce the event sequence when debugging in the IDE.

    It will be simpler putting the Debug.Write statements at the beginning and end of most of your Tab Events, but if your interested here is a simple way to do your whole app: Aspect Oriented Programming Method Boundary events

    My guess is that your cut-down repro project doesn’t have an event that fires after the TabPage1_Enter, where as your actual project does and is somehow taking the focus away from the textbox… which the Debug.Write output will show. HTH

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

Sidebar

Related Questions

I have a VB.NET Windows Forms project that at one point paints text directly
I have a windows forms (.net 3.0) project that won't run on my customer's
I have several .NET Windows Forms applications that I'm preparing to convert into a
I'm working on a visual studio 2005 vb.net windows forms project that's been around
I'm looking for digital low pass filter code/library/class for a .net windows forms project,
I have a regular .NET Windows Forms treeview control. The nodes are setup like
I would like to intercept the event in a .NET Windows Forms TabControl when
I have a C# .NET 3.0 project that uses a TableLayoutPanel containing several rows
With what GUI framework is the Mono .NET Windows.Forms implemented? Example: KDE, Gnome, X11
I am from a c# background and am converting a vb.net windows forms app

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.