Witam, uczę się wątków i mam kłopot, siedzę and tym sporo więc już mam straszny mętlik w głowie...
W Public Form1 stworzyłem nowy wątek:
Thread t1 = new Thread(One);
t1.Start();
No i stworzyłem metode:
public void One()
{
Label lab = new Label();
lab.Location = new Point(22, 100);
lab.Text = "Test";
tabPage1.Controls.Add(lab);
ProgressBar pBar1 = new ProgressBar();
pBar1.Location = new Point(41, 0);
pBar1.Size = new Size(588, 3);
tabPage1.Controls.Add(pBar1);
System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
timer.Enabled = true;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
}
No i jak mogę teraz dodawać wartość do progressbaru, który stworzyłem właśnie?
Zrobiłęm metodę:
private void timer_Tick(object sender, EventArgs e)
{
}
Ale VS nie pokazuje mi możliwości użycia pBar1. Jak prawidłowo powinienem to zrobić?