@ÜB3R' - Invoke a virtual key event for the Ctrl + A combination, then Delete or Backspace key, I would use this in it's own void or Sub, whatever, C#/VB. Call it when it's needed, Send the string for the listbox item, send Enter, remove ListBox item at index 0. Although with the way you have it going here, I would change things up a bit.
Example in C#:
Code:
private void button1_Click(object sender, EventArgs e)
{
new Thread(x => SendStrings()).Start();
}
private void SendStrings()
{
Thread.Sleep(1000);
int total = listBox1.Items.Count;
for (int x = 0; x < total; x++)
{
//INVOKE!
SendKeys.SendWait(listBox1.Items[0].ToString());
SendKeys.SendWait("{ENTER}");
Invoke((MethodInvoker)delegate {
listBox1.Items.RemoveAt(0);
listBox1.Update();
});
Thread.Sleep(1000);
}
}
• Start new thread
• Sleep thread for 1000 milliseconds
• Define a constant total because listBox1.Items.Count will change when we start removing items
• Loop from 0 for as long as x is less than the total that we've defined for our initial listBox1.Items.Count
• SendKeys for the listBox1.Item at index 0 as a string
• Since this is a thread we need to invoke to update the listBox and remove the item at 0
• Sleep for 1000 just for effect, so we can see a more transitional display of what this code does at a viewable pace
Note:
1) Each time we use listBox1 item at index 0, the buffer of items goes up every time through this loop as we continue to use item at index 0 and clear it out. 1 becomes index 0, 2 becomes index 1 and so on, until all of our items are gone, and none remain at index 0, therefore we should have no more listBox items by the time this loop is done with.
2) //INVOKE! - This is where I would be placing the call to the method where we invoke a virtual keypress to select everything, and delete the text from where ever location is currently active with the mouse ibeam.
Virtual Key constants are defined in a short list here:
http://forums.codeguru.com/showthread.ph...ost1737427
There's lots more that I know of, although with some research you probably will see what i'm talking about with Virtual Keys
I'll leave that up to you to find out what it is though. I've started you off with all that you need to know here, and provided you a good direction for what you're trying to achieve.