Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Dialog Event? Refresh attempt.

Dialog Event? Refresh attempt.

Scheduled Pinned Locked Moved C#
databasequestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    irishhokie
    wrote on last edited by
    #1

    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(); }

    D 1 Reply Last reply
    0
    • I irishhokie

      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(); }

      D Offline
      D Offline
      dazinith
      wrote on last edited by
      #2

      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

      I 1 Reply Last reply
      0
      • D dazinith

        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

        I Offline
        I Offline
        irishhokie
        wrote on last edited by
        #3

        ROCK.:cool: Thanks dz, that was it. Piece of cake.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups