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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:34:27+00:00 2026-06-09T19:34:27+00:00

I have a win app form with 3 text boxes and buttons as dial

  • 0

I have a win app form with 3 text boxes and buttons as dial pad (it’s a touchscreen app)…

When a dial pad button is pressed I want to check which one of these 3 text boxes has focus, and append text to it.

Something like:

if (tbx1.Focused == true)
{
   tbx1.Text += "0";
}
else if (tbx2.Focused == true)
{
   tbx2.Text += "0";
}
else
{
   tbx3.Text += "0";
}

But this doesn’t work… It appends text to tbx3 all the time.
Any suggestions?

Thanks 🙂

  • 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-09T19:34:29+00:00Added an answer on June 9, 2026 at 7:34 pm

    The problem arises when you click the button, the button will gain focus and not any of your textboxes.

    What you can do is subscribe to the LostFocus event and remember what textbox had the focus last.

    Something like:

    private TextBox lastFocused;
    private void load(object sender, EventArgs e){
        foreach (TextBox box in new TextBox[] { txtBox1, txtBox2, txtBox3 }){
            box.LostFocus += textBoxFocusLost;
        }
    }
    
    private void textBoxFocusLost(object sender, EventArgs e){
        lastFocused = (TextBox)sender;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have am building a win forms app which will have a text box
We have a C# win Form app called Installer that silently installs various 3rd
Scenario I have a C# Win Forms App, where the Main Form contains a
hi i have written app on vs2008 c# (express edition) on win XP which
I have a Windows form App which write to log files using log4net. The
I have a databound DataGridView in a Win Forms app which the user may
I have a win form app with a listbox displaying methods (by attribute). I
I want to convert a small win-form app to WPF App. I am using
I have a c# windows form app in which we did a rapid prototype
I working on a C# win-form app. in my form i have Data-Grid-View that

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.