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

  • Home
  • SEARCH
  • 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 8114745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:14:30+00:00 2026-06-06T03:14:30+00:00

I want to bring the cursor to a textbox when i clicked a button.

  • 0

I want to bring the cursor to a textbox when i clicked a button. How can i do that? I tried Focus() method but it didn’t not work. The code is shown below.

CsNIPAddrTextBox.Focus();
CsNIPAddrTextBox.TabIndex = 1;
  • 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-06-06T03:14:32+00:00Added an answer on June 6, 2026 at 3:14 am

    If that’s a ‘proper’ TextBox (i.e. not custom) then simply calling Focus() should work. It might not, however, if it’s read-only (I’m not sure – I’ve not tried. I know you can get a caret in a read-only box, which implies it can get focus). Certainly if it’s not Enabled then you won’t be able to set focus.

    Check the CanFocus property is true – if it’s not, then there might be some other reason preventing the control from receiving focus.

    If that’s true, however, and the caret still doesn’t make it to the control – you need to verify that it is receiving it. Add an event handler for the text box’s GotFocus event and breakpoint it to clarify that it gets hit. My guess is that it your breakpoint will be hit. If so – then the answer is that another process is setting focus to another control immediately after your button click occurs. For example, if you do this kind of thing in a validation event handler you’ll get a similar result, because the Windows Forms pipeline is already in the process of changing controls when the handler is fired.

    Also – why are you setting TabIndex=1? Generally TabIndex is set at design time and left alone (unless of course these are dynamically created). Unless you have a particular reason for doing this I’d get rid of that line. It doesn’t have a bearing on why this would/wouldn’t work – just an observation.

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

Sidebar

Related Questions

I want to bring a functionality to my Android app , that users can
How can I bring my RubyCocoa application to the front? Basically I want to
I want to create java program that can pause / play the vlc video
I want to add css styles with jQuery, but not be in in the
I want to bring a single Objective-C class written using ARC into an old
I want to bring a .dll dependency into my Qt project. So I added
i.e. I want to bring this in my code: static BOOL MyConstantBool = YES;
how do i bring the tr value into .click event? i want to be
I want to access the Bing search by creating a WebBroswerTask that then enters
I have 2 databases that have the same structure, but different data. Both are

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.