On a WinForm application, I have a form that contains a GridView, I am filling the GridView by collecting the data from a database. I Have a pictureBox that contains a Loading.gif image. What do i want is to view the PictureBox during retrieving the data from the database.
I tried the bellow code, but it did not work...
private void Generate_Button_Click(object sender, EventArgs e) { pictureBox1.Visible = true; { Generate_Button.Text = "Done"; if (conn.State == ConnectionState.Closed) conn.Open(); radGridView1.Columns.Add(new GridViewTextBoxColumn("Account No.")); radGridView1.Columns[0].Width = 85; bool DataAvailable = false; if (MainAccNo_TextBox.Text == "" && CurencyNo_TextBox.Text == "") { if (SeparateBy_DropDownList.Text == "4") { for (int i = 1; i <= 9; i++) { for (int j = 0; j <= 9; j++) { for (int k = 0; k <= 9; k++) { for (int l = 0; l <= 9; l++) { SqlCommand cmd_AccNo = new SqlCommand("Select distinct(AccNo) from JourTrans where AccNo like '" + i + "" + j + "" + k + "" + l + "%'", conn); SqlDataReader reader_AccNo = cmd_AccNo.ExecuteReader(); radGridView1.Rows.Add(i + "" + j + "" + k + "" + l); while (reader_AccNo.Read()) { Accounts.Add(reader_AccNo["AccNo"].ToString()); radGridView1.Rows.Add(reader_AccNo["AccNo"].ToString()); DataAvailable = true; } reader_AccNo.Close(); if (DataAvailable == true) { radGridView1.Rows.Add(""); DataAvailable = false; } else radGridView1.Rows.RemoveAt(radGridView1.Rows.Count - 1); } } } } } } } pictureBox1.Visible = false; }
http://soundfrost.org/ >download youtube videos