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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:43:24+00:00 2026-06-13T22:43:24+00:00

I want to design changing time on maskedtextbox in my application like windows where

  • 0

I want to design changing time on maskedtextbox in my application like windows where time changes on every second. I have set maskedtexbox1 as below:

maskedTextBox1.Text = DateTime.Now.ToShortTimeString();

which is showing current system short time but it’s not changing on every second like windows. How to do?

I’m on Visual Studio 2005, and .NET is below 3.5.

  • 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-13T22:43:25+00:00Added an answer on June 13, 2026 at 10:43 pm

    I’d use the timer and fire an event every second to update the time.

    1. Create a timer (an instance of class Timer in the package System.Windows.Forms).
    2. Set its frequency to 1 second (i.e. 1000 milliseconds).
    3. Tell it what method to call when it goes off (the event handler Kaboom).

    Somewhere in your executable code you do that by typing the following.

    Timer ticker= new Timer();
    ticker.Interval = 1000;
    ticker.Tick += new EventHandler(Kaboom);
    

    In the same class (or, if you’re confident how to do it, somewhere where you can reach the code) you also create the handler for the fired event of ticking, so that the promise you made about a method to be called when the timer goes off is kept.

    private void Kaboom(Object sender, EventArgs eventArgs)
    {
      // Execute the tickability code
      MaskedTextBox1.Text = DateTime.Now.ToShortTimeString();
    }
    

    Also, don’t forget to actually start your ticker when you feel that you’re ready.

    MyTimer.Start();
    

    Tada!

    EDIT:

    For the sake of completeness, I’m also going to paste in a part of the reply of @CuaonLe (a higher threshold of competence and requirement for .NET 3.5 or newer).

    Timer timer = new Timer { Interval = 1000 };
    timer.Tick += (obj, args) 
      => MaskedTextBox1.Text = DateTime.Now.ToLongTimeString();
    timer.Start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently our new database design is changing rapidly and I don't always have time
I want to design a chat view like BlackBerry messenger (unfortunately new users are
this is a CSS / design question. I have three textboxes that i want
I have made a simple design-time template that uses an enum that resides in
I am using c3P0 in my system. I have design question related to changing
I'm just changing design errors made in the past, but want to keep backwards
I'm building an application using the MVVM design pattern and I want to make
For my design i have in the xml file something like: The design is
I want design my startup screen with progress bar. But I don't how to
Am working on international project, and want design 3 major tables structure as required

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.