473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

text display in textbox with timer

Tom
Hi,

I want to display a text "Hello" in a textbox for every 30
seconds. How can I do this?

I saw the code

Expand|Select|Wrap|Line Numbers
  1. static void Main()
  2. {
  3. Application.Run(new main());
  4. }
  5.  
  6. private void textBox1_TextChanged(object sender,
  7. System.EventArgs e)
  8. {
  9. }
  10.  
Do I need to make use of the textBox1_TextChanged method?
How can I pass parameters to it?

Or, I can write my own method? But, how to display the
string line by line counted with timer? I have not deal
with timer before.

Thanks for suggestion.

Nov 15 '05 #1
4 12713
Tom, first you need to add a timer control to your application and set the
appropriate properties (interval, etc). Once you have the timer you need to
catch the Tick event which is thrown every time your interval occurs. In
the Tick event handler you can change the value of your textbox. Here's a
sample of how to use the timer class.

http://www.csharphelp.com/archives/archive90.html

--
Greg Ewing [MVP]
http://www.claritycon.com/


"Tom" <ke*****@yahoo.com> wrote in message
news:03****************************@phx.gbl...
Hi,

I want to display a text "Hello" in a textbox for every 30
seconds. How can I do this?

I saw the code

Expand|Select|Wrap|Line Numbers
  1.  static void Main()
  2.  {
  3.     Application.Run(new main());
  4.  }
  5.  private void textBox1_TextChanged(object sender,
  6.  System.EventArgs e)
  7.  {
  8.  }
  9.  

Do I need to make use of the textBox1_TextChanged method?
How can I pass parameters to it?

Or, I can write my own method? But, how to display the
string line by line counted with timer? I have not deal
with timer before.

Thanks for suggestion.

Nov 15 '05 #2
Here is my code:

private System.Windows.Forms.Timer timer1;

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.timer1.Enabled = true;
this.timer1.Interval = 20000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

private void timer1_Tick(object sender, System.EventArgs e)
{
this.textBox1.Text = DateTime.Now + " hello .....";
}

The DateTime.Now hello does not display line by line for every 2
seconds.

How can I fix it?

Thanks for help
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #3
Tom, did you start the timer?

--
Greg Ewing [MVP]
http://www.claritycon.com/
"Tom Pair" <ke*****@yahoo.com> wrote in message
news:#4**************@TK2MSFTNGP12.phx.gbl...
Here is my code:

private System.Windows.Forms.Timer timer1;

this.timer1 = new System.Windows.Forms.Timer(this.components);

this.timer1.Enabled = true;
this.timer1.Interval = 20000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

private void timer1_Tick(object sender, System.EventArgs e)
{
this.textBox1.Text = DateTime.Now + " hello .....";
}

The DateTime.Now hello does not display line by line for every 2
seconds.

How can I fix it?

Thanks for help
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #4
Hello,

The timer works now when I start it.

Thanks for your help.

Tom

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Mr. B | last post by:
While at first this may seem a simple tast, it has plagued me for a while... What I want to do is to have the background colour of something like a TextBox to change from (say) White to Yellow to...
5
by: Will Gillen | last post by:
I need to have a "scrolling" text label or textbox at the bottom of my window to show the URL of where a song is being played from. I want the text to scroll on a single line from left to right in...
3
by: shishuda91 | last post by:
I'd like to display scrolling, word-wrapped, centered text on a blank white screen with no window borders, nothing. Just a pure white screen with big letters in the middle (in an invisible box)....
13
by: WALDO | last post by:
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20 lines of text per second. I use the AppendText() method to accomplish this. This is a great substitute for taking the...
5
by: CCLeasing | last post by:
Hello, I have searched google but can not find a straight forward answer to my problem. Hopefuly someone will be kind enough to offer their expertise. Please forgive if this seems a bit convoluted...
0
by: andytsummers | last post by:
Hi I have tried to implement drag and drop by using the following code but I have several problems. 1. When you put your mouse over selected text the cursor is still the i-beam and therefore...
3
by: Mike | last post by:
Is there a way to determine if a user deleted text in a asp:textbox? I have a textbox were users can enter in a product number, then they click a button to see if the product numbers(s) exists in...
4
by: pablorp80 | last post by:
Hello, Here is what I need: I need the focus and the cursor set to a textbox named txtGT, every time no matter if it is the first page load or whether it is a postback. Here is the problem: I...
1
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.