Dialog Event? Refresh attempt.
-
This is probably an easy thing to do, but I can't figure out the syntax to save my life.:wtf: I'm clicking a button on FormRed to launch a Dialog that will enter a new number to be added to a combobox on Form Red. I can Add it to the database from that launched Dialog, but when it closes, I can't get the parent Form Red to refresh, it appears if I close and re-open it though. What kind of syntax am I missing to make this work? Thanks!:-D private void buttNew_Click(object sender, System.EventArgs e) { frmCreateProblemReport cpr = new frmCreateProblemReport(this.conns); cpr.ShowDialog(); cmbPRNumber.Refresh(); }
-
This is probably an easy thing to do, but I can't figure out the syntax to save my life.:wtf: I'm clicking a button on FormRed to launch a Dialog that will enter a new number to be added to a combobox on Form Red. I can Add it to the database from that launched Dialog, but when it closes, I can't get the parent Form Red to refresh, it appears if I close and re-open it though. What kind of syntax am I missing to make this work? Thanks!:-D private void buttNew_Click(object sender, System.EventArgs e) { frmCreateProblemReport cpr = new frmCreateProblemReport(this.conns); cpr.ShowDialog(); cmbPRNumber.Refresh(); }
once you come back from the dialog you need to call whatever function you have which populates your combobox with values from your database.. something like:
private void buttNew_Click(object sender, System.EventArgs e)
{
frmCreateProblemReport cpr = new frmCreateProblemReport(this.conns);
if (cpr.ShowDialog() == DialogResult.OK)
PopulateComboBox();
}just make sure that since you are populating the combobox multiple times that the
PopulateComboBox()
function begins with:cmbPRNumber.Items.Clear()
just because you call a dialog and you know what you want it to do with the data entered doesnt mean your other form will instantly reload everything.. you have to tell it to.. hope that helps.. still a newb.. cut me some slack :P -dz
-
once you come back from the dialog you need to call whatever function you have which populates your combobox with values from your database.. something like:
private void buttNew_Click(object sender, System.EventArgs e)
{
frmCreateProblemReport cpr = new frmCreateProblemReport(this.conns);
if (cpr.ShowDialog() == DialogResult.OK)
PopulateComboBox();
}just make sure that since you are populating the combobox multiple times that the
PopulateComboBox()
function begins with:cmbPRNumber.Items.Clear()
just because you call a dialog and you know what you want it to do with the data entered doesnt mean your other form will instantly reload everything.. you have to tell it to.. hope that helps.. still a newb.. cut me some slack :P -dz
ROCK.:cool: Thanks dz, that was it. Piece of cake.