Hi,
I wrote these codeforactivate my Progressbar. Its works but itsdoesnt pass to another form (form2). How can do?
Thank you,
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- int progress = 0;
- public Form1()
- {
- InitializeComponent();
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- this.progressBar1.Increment(1);
- if(progressBar1.Value == progressBar1.Maximum)
- {
- this.timer1.Stop();
- }
- progress += 1;
- if (progress >= 100)
- {
- timer1.Enabled = false;
- timer1.Stop();
- }
- progressBar1.Value = progress;
- percentTxt.Text = progress.ToString()+".00 %";
- }
- private void button1_Click(object sender, EventArgs e)
- {
- timer1.Enabled = true;
- timer1.Interval = 50;
- Form2 frm2 = new Form2();
- frm2.ShowDialog();
- }
- }
- }