hi my freind im wanat to insert data in data grid view from text box for example when the mouse leave the text box then data transmit into dbgrid view from text box could you help me to do this, thank you ;-)

8 Years
Discussion Span
Last Post by sbglobal

I wrote simple example and I hope it helps you:
first add textbox & datagridview
then write this code in textbox_mouseleave event:

private void textBox1_MouseLeave(object sender, EventArgs e)
            DataTable dt = new DataTable();
            dt.Columns.Add("col name", typeof(string));
            DataRow DR = dt.NewRow();
            DR["col name"] = textBox1.Text.ToString();
            dataGridView1.DataSource = dt;

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).


thank you my firend and so can you tell me how can i Compose to tables filds to gether and show both of them in one data gird view for example we have two tables which is student_tables and the other is grade_tables ok? and now i want to show information from both of tables in one data gird view in my windows form application thank you


i hv the same problem with vb 6.0 & im using msaccess for the database. Ple help me to code my program as im unable to pass the values display in the text boxes to the data grid in the same form

thnx in advance

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.