Click here to Skip to main content
Rate this: bad
good
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
rummer874
Comments
Mohd. Mukhtar at 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
0 Dnyaneshwar@Pune 719
1 CHill60 315
2 Sergey Alexandrovich Kryukov 240
3 TheRealSteveJudge 190
4 Peter Leow 160
0 Sergey Alexandrovich Kryukov 9,193
1 OriginalGriff 6,786
2 Peter Leow 4,332
3 Zoltán Zörgő 3,809
4 Richard MacCutchan 2,672


Advertise | Privacy | Mobile
Web03 | 2.8.150128.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