Click here to Skip to main content
15,921,382 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,I have written some code ,but i am getting errors.I dont know how to solve

The errors is

VB
Error   1   error C2679: binary '+' : no operator found which takes a right-hand operand of type 'const char [1]' (or there is no acceptable conversion)    c:\documents and settings\administrator\my documents\visual studio 2008\projects\dialog1\dialog1\dialog1dlg.cpp 178

Error   2   error C2664: 'CListBox::AddString' : cannot convert parameter 1 from 'char' to 'LPCTSTR'    c:\documents and settings\administrator\my documents\visual studio 2008\projects\dialog1\dialog1\dialog1dlg.cpp 180





the written code is
CString strTitle ;
int nIndex;
UpdateData(); // Transfer data from controls to variables

//get currently selected text
nIndex = GetDlgItemText(IDC_TITLE, strTitle); //assigning selected
m_strFullName = strTitle +" "+m_strFirstName +" "+m_strLastName;
m_strNameList.AddString(m_strFullName); //Add string to list

UpdaeData(FALSE);
Posted

I think the type of your m_strFirstName, m_strFullName, m_strLastName etc is char*.what ever it is change it to CString since your application supports MFC.
also change the code
m_strFullName = strTitle +" "+m_strFirstName +" "+m_strLastName;

to

m_strFullName = strTitle +_T(" ")+m_strFirstName +_T(" ")+m_strLastName;
 
Share this answer
 
Thank u verymuch Reshmi,its solved
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900