0

Hello, I wanna create a string witch gets the value of a textbox. How can I make it ? THX for your replays :D

5
Contributors
8
Replies
10
Views
7 Years
Discussion Span
Last Post by juuuh333
0

Haha.
Where is the textbox?
Is it a listbox, combobox or an edit control?
Using wxwidgets, mfc, atl, winapi or what?

The guessing game continues..

0

All you need is a system string, not a string. This procedure copies text from textBox to string and viceversa.

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
             String ^ strTextBoxContent;
             strTextBoxContent = textBox1->Text;
             textBox2->Text=strTextBoxContent;

         }

Edited by mike_2000_17: Fixed formatting

0

Winapi, if there is a window (hwnd) that has a child Edit control with ID 1:

HWND hwnd_edit = GetDlgItem(hwnd, 1);
size_t len = GetWindowTextLength(hwnd_edit);
if(len){
  char *buffer = new char[len+2];
  GetWindowText(hwnd_edit, buffer, len+1);
  buffer[len+1] = '\0';
  //And if it must be a string:
  std::string YourString(buffer);
  delete[] buffer;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.