I have one form in which I have one tab control and on that tab control. one tab page is for entering data in data grid. and in second tab page. that data grid is show. the problem is when I enter data in data grid and switch to view tab. data grid is not update its new values. so I have to reopen the form then entered values is shown. how I can see data in Data Grid immediately after entering in it? the code of my save button is as follows...
private void btnSave_Click(object sender, EventArgs e)
{
try
{
if (isValidated2())
{
con.ConnectionString = constr;
con.Open();
comnd.Connection = con;
comnd.CommandText = "INSERT INTO CoaEntry(AccName,[Amount],[Desc]) VALUES('" + cmboName.Text + "','"
+ txtAmount.Text + "','" + txtDesc.Text + "')";
reader = comnd.ExecuteReader();
MessageBox.Show("Record has been saved successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
con.Close();
}