Click here to Skip to main content
11,922,587 members (31,735 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Windows
I have text box and a button
After button click we have to show that data in my datagrid in windows.
Posted 26-Nov-12 20:14pm
Mohd. Mukhtar 27-Nov-12 1:15am
What have you tried??
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Try this it may help u

private void button1_Click(object sender, EventArgs e)
       DataTable dtToGrid = new DataTable();
        DataRow drToGrid;
        dtToGrid.Columns.Add(new DataColumn("EMP_ID", typeof(string)));
        dtToGrid.Columns.Add(new DataColumn("EMP_FName", typeof(string)));
        dtToGrid.Rows[0][0] = txt_empid.Text;
        dtToGrid.Rows[0][1] = txt_fname.Text;
        dataGridView.DataSource = dtToGrid;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151125.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100