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. Windows Forms
  4. Modal form opens second modal form when OK clicked on second form both close

Modal form opens second modal form when OK clicked on second form both close

Scheduled Pinned Locked Moved Windows Forms
salesquestion
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.
  • P Offline
    P Offline
    ProSlacker
    wrote on last edited by
    #1

    I open a modal form to search for an order that opens another modal form to search for a customer ID to narrow the order search. When OK is clicked on the second form both modals close and return to the main form. Can someone smarter than I please point me in the right direction? code that opens first modal

    private void OpenSalesOrderSearch()
    {
    try
    {
    SOSearch soSearch = new SOSearch();
    if (soSearch.ShowDialog() == DialogResult.OK)
    {
    MessageBox.Show("custID=" + soSearch.custID);

                }
                
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
         
        }
    

    code for second modal

    private void CustomerSearch()
    {
    try
    {
    CustSearch custSearch = new CustSearch();
    if (custSearch.ShowDialog() == DialogResult.OK)
    {
    custID = custSearch.custID;
    }
    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.ToString());
    }
    }

    OK button code for second modal

    private void btnOK_Click(object sender, EventArgs e)
    {
    custID = dgvCustomer.CurrentRow.Cells[0].Value.ToString();

        }
    
    P 1 Reply Last reply
    0
    • P ProSlacker

      I open a modal form to search for an order that opens another modal form to search for a customer ID to narrow the order search. When OK is clicked on the second form both modals close and return to the main form. Can someone smarter than I please point me in the right direction? code that opens first modal

      private void OpenSalesOrderSearch()
      {
      try
      {
      SOSearch soSearch = new SOSearch();
      if (soSearch.ShowDialog() == DialogResult.OK)
      {
      MessageBox.Show("custID=" + soSearch.custID);

                  }
                  
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.ToString());
              }
           
          }
      

      code for second modal

      private void CustomerSearch()
      {
      try
      {
      CustSearch custSearch = new CustSearch();
      if (custSearch.ShowDialog() == DialogResult.OK)
      {
      custID = custSearch.custID;
      }
      }
      catch (Exception ex)
      {
      MessageBox.Show(ex.ToString());
      }
      }

      OK button code for second modal

      private void btnOK_Click(object sender, EventArgs e)
      {
      custID = dgvCustomer.CurrentRow.Cells[0].Value.ToString();

          }
      
      P Offline
      P Offline
      ProSlacker
      wrote on last edited by
      #2

      OK I feel stupid. I had DialogResult set to cancel for the button that opened the second modal. My first post after lurking for a few years and I make a fool of myself. :-O

      B 1 Reply Last reply
      0
      • P ProSlacker

        OK I feel stupid. I had DialogResult set to cancel for the button that opened the second modal. My first post after lurking for a few years and I make a fool of myself. :-O

        B Offline
        B Offline
        BillWoodruff
        wrote on last edited by
        #3

        ProSlacker wrote:

        My first post after lurking for a few years and I make a fool of myself

        Hi ProSlacker, May I slightly disagree with you, and suggest you've demonstrated you are a virtuous person who is self-confident enough to publicly correct the kind of mistake anyone can make with a sense of humor in a pro-social way ? best, Bill

        "Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844

        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