Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

A little help in visual c++

Options
  • 28-02-2005 4:03am
    #1
    Registered Users 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 Posts: 6,508 ✭✭✭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 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