CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2011
    Posts
    6

    Unhappy please hep textBox1->Text = s;

    string s;
    s = "kamil";
    textBox1->Text = s;

    and I have an error message

    1>Dizi.cpp
    1>c:\vc\dizi\dizi\Form1.h(112) : error C2664: 'void System::Windows::Forms::Control::Text::set(System::String ^)' : cannot convert parameter 1 from 'std::string' to 'System::String ^'
    1> No user-defined-conversion operator available, or
    1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
    1>Build log was saved at "file://c:\VC\Dizi\Dizi\Release\BuildLog.htm"
    1>Dizi - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    please help me?

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: please hep textBox1->Text = s;

    Your code is managed C++, not native C++. Try posting your question here.

  3. #3
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    Re: please hep textBox1->Text = s;

    First, take a look at this discussion: http://www.codeguru.com/forum/showthread.php?t=511412

    [ Moved thread ]
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  4. #4
    Join Date
    Aug 2000
    Location
    West Virginia
    Posts
    7,721

    Re: please hep textBox1->Text = s;


  5. #5
    Join Date
    Apr 2011
    Posts
    6

    Re: please hep textBox1->Text = s;

    I solved problem. Thanks for all;

    mktArray < char * > * le = new mktArray < char * >;
    le->Add("kamil");
    le->Add("turan");
    le->Add("safranbolu");
    String ^ s = gcnew String(le->Get(0));
    textBox1->Text = s;
    delete le;


    I can convert char * to string that use String ^ s = gcnew String.

  6. #6
    Join Date
    Mar 2011
    Posts
    27

    Re: please hep textBox1->Text = s;

    Quote Originally Posted by mkamilturan View Post
    string s;
    s = "kamil";
    textBox1->Text = s;
    The simplest way:

    Code:
    String^ txt = "Kamil";				
    textBox1->Text = txt;
    Cheers
    Last edited by smallbit; April 29th, 2011 at 02:54 AM.

  7. #7
    Join Date
    May 2011
    Posts
    9

    Re: please hep textBox1->Text = s;

    im pretty sure that all you have to do is:

    this->textBox1->Tekst = s;
    Last edited by Dutchman; May 10th, 2011 at 10:38 AM.

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