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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:32:53+00:00 2026-05-26T23:32:53+00:00

Borland’s VCL library has application wide events that let me do some global keystroke

  • 0

Borland’s VCL library has application wide events that let me do some global keystroke processing. Is there anything like this in .NET Winforms?

I have a Winforms app with about 10 forms so far, and unfortunately I didn’t create a baseclass that all forms derive from (the process didn’t seem as simple as it was in VCL) so I can’t just add code to the base class. Unless it would be easy to add that now and quickly subclass the 10 existing forms?

What my end-user wants is a way to catch certain keystroke combinations entered in any field and replace them with other words. Like typing “so” would be replaced with “stack overflow”.

Not looking for exact code or anything, just some ideas on general ways to handle this. So far I’ve thought of subclassing all forms, or subclassing all textbox controls, but not sure what other options there are? In VCL I would catch the global keydown event, check the active control, check the text in the control, and based on the text and the current selection I would replace as needed.

  • 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-26T23:32:54+00:00Added an answer on May 26, 2026 at 11:32 pm

    To further Hans’ suggestion, you might want to create a behavior class that has a method that matches the event handler signature of TextChanged, and holds the algorithm.

       public class AutoTextBehavior
        {
            public void TextChanged(object sender, EventArgs e)
            {
                Console.WriteLine("Text Changed");
            }
        }
    

    Then you can hook to TextChanged of any of the input controls that you want to have this behavior.
    For example in the constructor of a form that has two textboxes (t1 and t2), you could put the following:

    public class Form1 : Form
    {
         AutoTextBehavior behavior = new AutoTextBehavior();
    
         public Form1()
         {
             InitializeComponent();
             this.t1.TextChanged += behavior.TextChanged;
             this.t2.TextChanged += behavior.TextChanged;
         }
    ...
    }
    

    Or you could make the controls instantiate their own behavior:

    public class myApplicationTextbox : Textbox
    {
       AutoTextBehavior behavior = new AutoTextBehavior();
    
             public myApplicationTextbox()
             {
                 InitializeComponent();
                 TextChanged += behavior.TextChanged;
             }
    ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Borland C++ Builder and the application that I'm working on has
To preface I am using Borland C++ and the VCL. I need some sort
I'm trying to read the Borland Starteam application oracle database and I noticed that
I need to get some AVI animations for use with the Borland VCL TAnimate
I must make some improvements on an application written in Borland C++ 6. I
I compiled my code using Borland 5.5 and there was no errors that popped
I'm looking at upgrading the Borland/Codegear/Embarcadero C++ builder suite we use for some of
I have a .NET program and a Borland Win32 program that need to pass
I'm using the Borland (AKA Embarcodegearland) C++Builder 2007 compiler which has a minor bug
I have a Borland C++ application and I am new to desktop applications. I

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.