CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Location
    The North Bay, California
    Posts
    142

    simple refresher question

    he he, i feel aweful, i forgot how to do a simple 2 or 4 digit command after using vb

    any way, i have my messagebox, and i want it to display some text, then a variable, then some more text.
    ex:
    Code:
    MessageBox("text ??Var1\r\ntext ??var2",.......)
    something similar to that, wheere the ?? is possible where the stuff goes

    thx
    I would not say that the subject is boring, nor that I get enough sleep as the reason for me dosing in class, rather, I would say that I am too comfortable, causing me to loose interest in the class subject and focus on becoming more comfortable...

  2. #2
    Join Date
    Jun 2003
    Location
    Gjøvik, Norway
    Posts
    204
    Use a std::ostringstream to build the string before passing it to the messagebox:
    Code:
    #include <sstream>
    ...
    std::ostringstream message;
    message << "This is a text with a number: " << 100 << ", and some more text...";
    MessageBox(message.str().c_str(), ...whatever parameters are needed...);

  3. #3
    Join Date
    Jul 2003
    Location
    The North Bay, California
    Posts
    142
    cool, i got it, at first i forgot the ; at the end, and it didnt work, but i remembered

    thanks
    I would not say that the subject is boring, nor that I get enough sleep as the reason for me dosing in class, rather, I would say that I am too comfortable, causing me to loose interest in the class subject and focus on becoming more comfortable...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured