private void btnSearch_Click(object sender, EventArgs e) { //dgvSearch.Rows.Clear(); int name = Convert.ToInt32(cboxJewlName.SelectedValue); int material=Convert.ToInt32(cboxJewlMaterial.SelectedValue) ; DataTable table = Bllcombohelper.getAllSelectedJewl(name, material); int roows=table.Rows.Count; int j=0; while (j < roows) { if (j > 14) { dgvSearch.Rows.Add(1); dgvSearch.ScrollBars = ScrollBars.Vertical; } dgvSearch.Rows[j].Cells[0].Value = table.Rows[j].ItemArray[0].ToString(); dgvSearch.Rows[j].Cells[1].Value = table.Rows[j].ItemArray[5].ToString(); dgvSearch.Rows[j].Cells[2].Value = table.Rows[j].ItemArray[6].ToString(); dgvSearch.Rows[j].Cells[3].Value=table.Rows[j].ItemArray[7].ToString()+"/-"; dgvSearch.Rows[j].Cells[4].Value = table.Rows[j].ItemArray[4].ToString(); j = j + 1; } //table.Clear(); }
also i tried table.Clear();
table.Clear(); dgvSearch.DataSource = table;
private void btnSearch_Click(object sender, EventArgs e) { dgvSearch.DataSource = null; dgvSearch.Rows.Clear(); dgvSearch.Columns.Clear(); // Your code }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)