billy_bob169 Posted April 29, 2003 Posted April 29, 2003 I am trying to Concatenate two strings in a VS.NET 2003 C++ Windows application, and I cannot seem to get it to work. Does anyone have any ideas? The statement doesn't do anything...the compiler does not blow up either! The MessageBox just shows the first string! :( { String *msg = "Customer Order\n"; msg->Concat(S" Processors\n"); MessageBox::Show(msg); } Quote I'd rather be riding than working
billy_bob169 Posted April 30, 2003 Author Posted April 30, 2003 For anyone else who runs into this, this is how I got it to work: { String* msg = "Customer Order\n"; msg = String::Concat(msg, S" Processors\n"); MessageBox::Show(msg); } Not quite sure hom to get the "msg->Concat(S"String2");" to work, but if anyone figures it out, I would like to know. Good Luck! Quote I'd rather be riding than working
*Gurus* divil Posted April 30, 2003 *Gurus* Posted April 30, 2003 Concat is a static method of the String class, so even when you were calling msg->Concat, you were really just calling the static one which obviously doesn't modify any source string. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
billy_bob169 Posted April 30, 2003 Author Posted April 30, 2003 I see. So I have to code it as such: { String* msg = "Customer Order\n"; msg = msg->Concat(msg, S" Processors\n"); MessageBox::Show(msg); } Thanks Divil Quote I'd rather be riding than working
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.