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 ;-)

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();
            dt.Rows.Add(DR);
            dataGridView1.DataSource = dt;
            
         }

Edited 6 Years Ago 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
regards
uda

This article has been dead for over six months. Start a new discussion instead.