Event Notification is the best solution. I used a while (XXX) to wait. Later I found some problems:
Using System;
Using System. text;
Using System. Windows. forms;
Using System. Threading;
namespace windowsapplication1
{< br> Public partial class form1: form
{< br> Public form1 ()
{< br> initializecomponent ();
}
Private VoidButton#click (ObjectSender, eventargs E)
{
Thread th= NewThread (yourthread );
Th. Start ();
}
Private Void Textbox1_textchanged ( Object Sender, eventargs E)
{
If (Textbox1.text. Length > = 4 )
{
Detailcollectedevent. Set (); // When textbox1 contains more than four characters, send a notification.
}
}
Autoresetevent detailcollectedevent = New Autoresetevent ( False );
Void Yourthread ()
{
MessageBox. Show ( " Input you bank account details into the textbox " );
Detailcollectedevent. waitone (); // Waiting for notification
MessageBox. Show ( " We will keep the secret. " );
}
}
}