G
Guest
After clicking btnDeleteSize_Click in frmSize, I move to frmSizeDelete, allow
deleting a Size using a datagrid, and then return to frmSize and want to
update the datagrid in frmSize to reflect the deletion. I can't figure out
how to get the datagrid in frmSize updated, although the datagrid in
frmSizeDelete shows the deletion properly.
In frmSizeDelete the size is properly deleted when the user clicks the row
in the datagrid and presses the delete key:
private void frmSizeDelete_Load(object sender, System.EventArgs e)
{
strCommandText = "SELECT SizeID, SizeName FROM tblSize WHERE SizeID = '" +
strCurrentSize + "'";
this.oleDbSelectCommand1.CommandText = strCommandText;
oleDbDataAdapter1.Fill(dsSizeDelete1);
}
private void frmSizeDelete_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
oleDbDataAdapter1.Update(dsSizeDelete1);
}
However, when I return to frmSize I can't figure out how to show the updated
datagrid.
The following code has no errors, but doesn't work:
private void btnDeleteSize_Click(object sender, System.EventArgs e)
{
// dgSize.ReadOnly = false; (dgSize is readonly, does this matter in showing
the update?)
DialogResult button =
MessageBox.Show("Are you sure you want to delete this size? This size will
be deleted from ALL product parts!!!", "Delete Size",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (button ==DialogResult.Yes)
{
Form newSizeDeleteForm = new frmSizeDelete(txtSizeID.Text);
newSizeDeleteForm.Show();
dsSize1.Clear();
oleDbDataAdapterSize.Fill(dsSize1);
oleDbDataAdapterSize.Update(dsSize1);
dgSize.Update();
dgSize.Show();
I added these last 5 statements in the hopes of making the datagrid in
frmSize show the change, and I don't know if any of them are needed, but they
do not show the change as expected. What should I do?
Thanks,
Pam
deleting a Size using a datagrid, and then return to frmSize and want to
update the datagrid in frmSize to reflect the deletion. I can't figure out
how to get the datagrid in frmSize updated, although the datagrid in
frmSizeDelete shows the deletion properly.
In frmSizeDelete the size is properly deleted when the user clicks the row
in the datagrid and presses the delete key:
private void frmSizeDelete_Load(object sender, System.EventArgs e)
{
strCommandText = "SELECT SizeID, SizeName FROM tblSize WHERE SizeID = '" +
strCurrentSize + "'";
this.oleDbSelectCommand1.CommandText = strCommandText;
oleDbDataAdapter1.Fill(dsSizeDelete1);
}
private void frmSizeDelete_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
oleDbDataAdapter1.Update(dsSizeDelete1);
}
However, when I return to frmSize I can't figure out how to show the updated
datagrid.
The following code has no errors, but doesn't work:
private void btnDeleteSize_Click(object sender, System.EventArgs e)
{
// dgSize.ReadOnly = false; (dgSize is readonly, does this matter in showing
the update?)
DialogResult button =
MessageBox.Show("Are you sure you want to delete this size? This size will
be deleted from ALL product parts!!!", "Delete Size",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (button ==DialogResult.Yes)
{
Form newSizeDeleteForm = new frmSizeDelete(txtSizeID.Text);
newSizeDeleteForm.Show();
dsSize1.Clear();
oleDbDataAdapterSize.Fill(dsSize1);
oleDbDataAdapterSize.Update(dsSize1);
dgSize.Update();
dgSize.Show();
I added these last 5 statements in the hopes of making the datagrid in
frmSize show the change, and I don't know if any of them are needed, but they
do not show the change as expected. What should I do?
Thanks,
Pam