String concatenation in vc++.net
-
hi.. this piece of code is from vc++.net MessageBox(0, "Please Check Row No:" + j ,"Validations",MB_OK); When i try to concatenate some text string with an integer value(j), it compiles successfully. but the output is confusing.. for example..if the value of j is 5, then it trim 5 chars from the left in hat text string.. SO i tried it with concat function...like this.. MessageBox(0, String::Concat("Please Check Row No:" , (Datagrid1->get_Item(j,0))) ,"Validations",MB_OK); This returns error "error C2665: 'System::String::Concat' : none of the 9 overloads can convert parameter 2 from type 'System::Object __gc *'" Can anyone solve my problem? Salai
-
hi.. this piece of code is from vc++.net MessageBox(0, "Please Check Row No:" + j ,"Validations",MB_OK); When i try to concatenate some text string with an integer value(j), it compiles successfully. but the output is confusing.. for example..if the value of j is 5, then it trim 5 chars from the left in hat text string.. SO i tried it with concat function...like this.. MessageBox(0, String::Concat("Please Check Row No:" , (Datagrid1->get_Item(j,0))) ,"Validations",MB_OK); This returns error "error C2665: 'System::String::Concat' : none of the 9 overloads can convert parameter 2 from type 'System::Object __gc *'" Can anyone solve my problem? Salai
-
Use CString object:
CString str; str.Format("Please Check Row No: %d Validations",j); MessageBox(0,str,MB_OK);
MatteoMaetto.. Thanks for yr reply.. i tried this... But it returns error "CString : Undeclared identifier." i put this code in .cpp file... should i have to include any header files here? Salai
-
Maetto.. Thanks for yr reply.. i tried this... But it returns error "CString : Undeclared identifier." i put this code in .cpp file... should i have to include any header files here? Salai
> CString str; > str.Format("Please Check Row No: %d Validations",j); > MessageBox(0,str,MB_OK); > But it returns error "CString : Undeclared identifier." char szBuf[200]; sprintf(szBuf, "Please Check Row No: %d Validations", j); MessageBox(0, szBuf, MB_OK);
-
Maetto.. Thanks for yr reply.. i tried this... But it returns error "CString : Undeclared identifier." i put this code in .cpp file... should i have to include any header files here? Salai
Never go heavyweight when lightweight works fine:
TCHAR caBuffer[ 64 + 1 ]; _snprintf( caBuffer, 64, "Please Check Row No: %d Validations", j ); caBuffer[ 64 ] = '\0'; MessageBox( NULL, "Example", caBuffer, MB_OK );
Peace! -=- James
If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
DeleteFXPFiles & CheckFavorites (Please rate this post!) -
Maetto.. Thanks for yr reply.. i tried this... But it returns error "CString : Undeclared identifier." i put this code in .cpp file... should i have to include any header files here? Salai