Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass a value to another CDialog

Status
Not open for further replies.

Huskey

Vendor
Aug 23, 2002
53
0
0
GB
Hi,

I have a CString value and want to pass it to another CDialog. How am I supposed to do that? Please help!! Thanks!

 
To pass values among dialogs (CDialog's):

1) Create a CString member value in each dialog class.
2) If the user selects OK in the first dialog class, save the value in the CString member variable (of the first dialog class.)
3) After calling DoModal() on the first dialog, assign the CString member variable of the second dialog the value of the CString member variable of the first dialog.
4) Call DoModal() on the second dialog.

If you need a code snippet, let me know.

Hope this information hlpes! Happy coding! :)
*~-> EOR Candy <-~*
 
Hi EOR Candy,

Thanks very much for your info. As I am still not familiar with Visual C++, a code snippet as an example would be nice.

Here is the example of my code:

BOOL CDialogODBCImporter::OnChangetype()
{
try {
CString slctcol;
int numscales;
m_CheckedBox.GetText(m_CheckedBox.GetCurSel(),slctcol); }

catch(CDBException* pEx)
{AfxMessageBox(pEx->m_strError);
pEx->Delete();
AfxMessageBox( &quot;Please select the column&quot; );
return FALSE;}

{ CAttributeChange AttribChange(NULL);
AttribChange.DoModal();}

return TRUE;
}

I actually want to bring the &quot;slctcol&quot; to &quot;attribute dialog box&quot; and then retrieve an integer value from that dialog box in return.

The details:
slctcol contains the strings either as &quot;Integer&quot;, &quot;Float&quot; or &quot;String&quot;. In the attribute box, I have a scaling exponent in integer, and would like to transfer it back to my first dialog box.

Many thanks for your help. Look forward to your reply.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top