N
N
Nikita Volkov2020-10-26 12:48:52
C++ / C#
Nikita Volkov, 2020-10-26 12:48:52

How to get text from textBox1 into string variable in CLI?

Here is the code:

private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
  ifstream fin;
  string x = textBox1->Text; // Тут ошибка

  fin.open("file.txt");

  if (fin.is_open()) {
        
  }
}

Mistake:
E0415 No suitable constructor exists to convert from "System::String ^" to "std::basic_string, std::allocator>"


I want to take the text from textBox1 and use it as a file path in the future

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2020-10-26
@SaNNy32

https://docs.microsoft.com/en-us/cpp/dotnet/how-to...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question