Click here to Skip to main content
12,503,947 members (56,890 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 19:14pm
rummer958
Comments
Mohd. Mukhtar 27-Nov-12 1:15am
   
What have you tried??
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Rate this: bad
 
good
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.Add();
        dtToGrid.Rows[0][0] = txt_empid.Text;
        dtToGrid.Rows[0][1] = txt_fname.Text;
 
        dataGridView.DataSource = dtToGrid;
      }
  Permalink  

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
Web02 | 2.8.160919.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2016
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