Hi, I need to create a Windows Form with a simple text box. The text field contains a timer, such as text (format 00:00).
I want to refresh the page every second and change the contents of the text field accordingly. (Like a digital clock, for example, one hour!).
I realized that I needed to use the System.Windows.Forms.Timer class, and I removed the Timer element from the ToolBox in my form.
What's next ... Do I need to use the Thread.Sleep(1000) function .. any ideas?
Here is the code I tried. I know where this happens incorrectly in the program, and the thread.sleep() even worsens my code to run. I tried Timer stuff in ToolBox but could not get through. (When I run the code, it compiles successfully, and then the application freezes for one hour due to dirty For-Loops).
public partial class Form1 : Form { Button b = new Button(); TextBox tb = new TextBox();
source share