CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2021
    Posts
    2

    Copy textbox data to a string

    // I have a textBox and would like to copy its contents
    // into a string called myColor

    string myColor= "BLUE"; // OK works as expected
    textBoxColor->Text = "BLUE"; // OK The textbox accepts a string literal
    // But ... none of the following seems to work - all have errors
    myColor = textBoxColor->Text;
    myColor = textBoxColor.Text;
    myColor = std::string( textBoxColor->Text);
    myColor = System::String(textBoxColor->Text);
    myColor = Convert.ToString(textBoxColor->Text);
    myColor = System::Convert::ToString(textBoxColor->Text);
    myColor = String::Parse(textBoxColor->Text);
    myColor = textBoxColor->Text;
    // ------------ Suggestions please
    // Bob

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,112

    Re: Copy textbox data to a string

    Quote Originally Posted by srfpala View Post
    ...
    // ------------ Suggestions please
    // Bob
    I'd suggest you to post your question to the appropriate forum.
    Your code has nothing to with the Visual C++ Programming!
    Victor Nijegorodov

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