Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

A little help in visual c++

  • 28-02-2005 04:03AM
    #1
    Registered Users, Registered Users 2 Posts: 221 ✭✭


    Hi im a software student

    wonder could anyone help me out . im reading in from an edit box to a member varible whats the update command i need to to go from edit box the varible and vise versa

    one more question having trouble converting const char [num] to cstring and vise versa

    any help hugly apprciated !!

    cheers

    p.s using microsoft visual c++ 6.0


Comments

  • Registered Users, Registered Users 2 Posts: 6,652 ✭✭✭daymobrew


    I associated "CString m_Edit1" with control IDC_EDIT1.
    I thought UpdateData() could be used to return data to the control but I couldn't get it to work.
    UpdateData();   // Retrieve data from the control.
    	AfxMessageBox( m_Edit1 );  // Display value.
    	m_Edit1 = "Me";  // Change value.
    	SetDlgItemText( IDC_EDIT1, m_Edit1 ); // Set it.
    

    and the second part...
    // Convert const string to CString. Easy.
    		const char Number[] = "12345";
    		CString strNum = Number;
    		cout << (LPCTSTR)strNum << endl;
    
                    // Convert a number to a char string. 
    		char szNum[ 6 ];
    		sprintf( szNum, "%d", 12345 );
    		cout << szNum << endl;
    


  • Registered Users, Registered Users 2 Posts: 221 ✭✭Elfman


    I think you have to declare either "UpdateData (TRUE) " or UpdateData (FALSE)" depending on if u want to go from varible to control or vise versa


Advertisement