|
-
Aug 17th, 2007, 12:12 AM
#1
Thread Starter
PowerPoster
-
Aug 17th, 2007, 12:16 AM
#2
Thread Starter
PowerPoster
Re: Whats the deal with Labels and Timers?
Hrmmm, it seems it does make the label show once the timer runs the second time....why not the first time?
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Aug 17th, 2007, 01:58 AM
#3
Re: Whats the deal with Labels and Timers?
Code? What happens in between Ticks?
-
Aug 18th, 2007, 12:58 PM
#4
Thread Starter
PowerPoster
Re: Whats the deal with Labels and Timers?
Ok it apears it is not the timers fault after all. It is any kind of loop that is the problem. I have a form that has a button, a label and a progress bar....the default setting on each control are left at default, eveything is set in the code.
Watch how when you click the button the progress bar shows and runs immediately, but the label doesnt appear until the loop that is incrimenting the progress bar is finished.
The strange part is the label is called to be visible before the loop even starts. And even if you put the label1.Visible=true in the LOOP it still wont show up! I just don't get it.
Here is the sample code
PHP Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
label1.Visible = false;
progressBar1.Visible = false;
}
private void button1_Click(object sender, EventArgs e)
{
label1.Visible = true;
label1.Text = "Testing";
progressBar1.Value = 0;
progressBar1.Visible = true;
progressBar1.Maximum = 100000;
progressBar1.Minimum = 0;
progressBar1.Step = 1;
for (int i = 0; i < 100000; i++)
{
progressBar1.Increment(1);
}
}//end timer1
}
}
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Aug 18th, 2007, 08:32 PM
#5
Re: Whats the deal with Labels and Timers?
Call the Label's Refresh method after setting its Text property. That will force it to repaint before the loop starts sucking up all the processor time.
-
Aug 19th, 2007, 12:30 AM
#6
Thread Starter
PowerPoster
Re: Whats the deal with Labels and Timers?
AHH! I didnt know it had a refresh method! Cool, ima try that right now.
Thanks!
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Aug 19th, 2007, 12:31 AM
#7
Thread Starter
PowerPoster
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|