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 / C++ / MFC
  4. Data from one dlg to another

Data from one dlg to another

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 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.
  • A Offline
    A Offline
    Ashman
    wrote on last edited by
    #1

    Hi, I need help again :) I have one dialog which I will call InvoiceDlg. On this dialog I have some controls. Lets say I have a static control called IDC_INVOICENUMBER. I have a button, IDC_TENDER, and when this button is pressed it will open another dlg called TenderDlg. I want to be able to get the data from InvoiceDlg into TenderDlg. I've tried alot of things such as: void CInvoice::OnTender() { CString invoicenumber; GetDlgItemText(IDC_INVOICENUMBER,invoicenumber); CTender dlg; dlg.DoModal(); dlg.m_invoiceme.SetWindowText(invoicenumber); } and; void CInvoice::OnTender() { // TODO: Add your control notification handler code here CString invoicenumber; GetDlgItemText(IDC_INVOICENO,invoicenumber); CTender dlg; dlg.DoModal(); dlg.SetDlgItemText(IDC_INVOICE, _T(invoicenumber)); } Both these compile with no dramas, however when I try them in the app; they dont do anything, its like they aren't even passing on the data through CTender dlg; Can someone please help me?! Im tired, I want to goto bed :(( lol Thanks Ashman

    M 1 Reply Last reply
    0
    • A Ashman

      Hi, I need help again :) I have one dialog which I will call InvoiceDlg. On this dialog I have some controls. Lets say I have a static control called IDC_INVOICENUMBER. I have a button, IDC_TENDER, and when this button is pressed it will open another dlg called TenderDlg. I want to be able to get the data from InvoiceDlg into TenderDlg. I've tried alot of things such as: void CInvoice::OnTender() { CString invoicenumber; GetDlgItemText(IDC_INVOICENUMBER,invoicenumber); CTender dlg; dlg.DoModal(); dlg.m_invoiceme.SetWindowText(invoicenumber); } and; void CInvoice::OnTender() { // TODO: Add your control notification handler code here CString invoicenumber; GetDlgItemText(IDC_INVOICENO,invoicenumber); CTender dlg; dlg.DoModal(); dlg.SetDlgItemText(IDC_INVOICE, _T(invoicenumber)); } Both these compile with no dramas, however when I try them in the app; they dont do anything, its like they aren't even passing on the data through CTender dlg; Can someone please help me?! Im tired, I want to goto bed :(( lol Thanks Ashman

      M Offline
      M Offline
      Michael P Butler
      wrote on last edited by
      #2

      Ashman wrote: dlg.DoModal(); dlg.SetDlgItemText(IDC_INVOICE, _T(invoicenumber)); The call to dlg.DoModal will show the dialog and therefore any further code in your function won't be executed until the dialog is closed. You'll need to pass the CString into your class before DoModal and then inside the WM_INITDIALOG handler, set the window text of the control. e.g void CInvoice::OnTender() { // TODO: Add your control notification handler code here CString invoicenumber; GetDlgItemText(IDC_INVOICENO,invoicenumber); CTender dlg; dlg.m_strInvoiceNo = invoiceNumber; dlg.DoModal(); } BOOL CTender::OnInitDialog() { CDialog::OnInitDialog(); m_invoiceme.SetWindowText(m_strInvoiceNo); } Michael But you know when the truth is told, That you can get what you want or you can just get old, Your're going to kick off before you even get halfway through. When will you realise... Vienna waits for you? - "The Stranger," Billy Joel

      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