Web ページのリローダーを作成していて、ユーザーからの入力を使用してリロードの数を取得しようとしていますが、ユーザーからの入力の数を取得できません。
でユーザー入力を取得しようとしていますtextBox2.Textが、次のエラーが発生しています:
input string was not in a currect format
このエラーはこの行にありますkkk = System.Int32.Parse(textBox2.Text);
値にユーザー入力を適切に取得する方法を教えてくださいint。
これは私のプログラムコードです:
public partial class Form1 : Form
{
    public  int kkk;
    public Form1()
    {
        InitializeComponent();
    }
    private void progressBar1_Click(object sender, EventArgs e)
    {
    }
    private void button1_Click(object sender, EventArgs e)
    {
        if (progressBar1.Value != kkk)
        {
            do
            {
                try
                {
                    webBrowser1.Navigate(textBox1.Text);
                    while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
                    {
                        Application.DoEvents();
                        if(webBrowser1.ReadyState == WebBrowserReadyState.Complete)
                        {
                            progressBar1.Value = progressBar1.Value + 1;
                        }
                    }
                    MessageBox.Show("Loaded");
                }
                catch(Exception)
                {
                    MessageBox.Show("failed");
                }
            }
            while(progressBar1.Value !=kkk);
        }   
    }
    private void Form1_Load(object sender, EventArgs e)
    {
        kkk = System.Int32.Parse(textBox2.Text);
        progressBar1.Maximum = kkk;        
    }
    private void textBox1_TextChanged(object sender, EventArgs e)
    {
}