in search button write this code i have used fluxgird for testing u can use datagridview
try
{
FormatGrid();
OleDbConnection con = new OleDbConnection(path);
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("Select * from ItemMast where IName like '" + txtICode.Text.Trim() + "%' order by IName", con);
DataSet ds = new DataSet();
da.Fill(ds, "ItemMast");
DataTable dt = ds.Tables["ItemMast"];
if (dt.Rows.Count > 0)
{
int i = 1;
MSGrid1.Rows = dt.Rows.Count + 1;
foreach (DataRow dr in dt.Rows)
{
MSGrid1.set_TextMatrix(i, 0, i.ToString());
MSGrid1.set_TextMatrix(i, 1, dr["ICode"].ToString());
MSGrid1.set_TextMatrix(i, 2, dr["IName"].ToString());
MSGrid1.set_TextMatrix(i, 3, dr["SubSubGroupName"].ToString());
MSGrid1.set_TextMatrix(i, 4, dr["GroupName"].ToString());
MSGrid1.set_TextMatrix(i, 5, dr["SubGroupName"].ToString());
double st1 = double.Parse(dr["AvlQty"].ToString());
if (CheckDecimal(st1) == false)
MSGrid1.set_TextMatrix(i, 6, st1.ToString("0"));
else
MSGrid1.set_TextMatrix(i, 6, st1.ToString());
i = i + 1;
}
}
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}