Erasing from a Text box.

Hello, I am very new to windows programming. I am just playing around with it and I was wondering how to erase the text in a box after hitting a button to put the text in another box. Instead, the text just stays there and if you hit the button again it just puts that text out again. Here is the code I used to get the text to go in to the box.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
namespace Windows_1
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            listBox1.Items.Add(textBox1.Text);
        }
    }
}


Thanks!
If your TextBox was created with CreateWindow("Edit",... or CreateWindowEx(0,"Static",... then you can erase the window's text with:

SetWindowText(hwnd, "");

Where hwnd is the handle to that box.
@Winston12, that code is C#, not C++. Post your question @ the MSDN forums.
Topic archived. No new replies allowed.