In c# windows application, I want to store the textbox values automaticaly into a database table as they are being entered.the database ro开发者_开发百科w should be updated as the user fills in all the textboxes. how to do it?
your question is really vague and generic. I assume you are working with Windows Forms.
Start reading some of the articles linked here: Windows Forms Data Binding
especially those about Navigate and Binding Data in Windows Forms.
In order to save it as they are changing, you can use event TextBox.TextChanged
:
void textBox1_TextChanged(object sender, EventArgs e)
{
string text = this.textBox1.Text;
// your saving
}
Ok. If you want to save it as the input "is finished", you can use the event TextBox.Leave
the same way.
精彩评论