Home > DeveloperSection > Forums > insert data in datagridview from text box c#
Ankit Singh

Total Post:341

Posted on    February-08-2016 10:33 PM

 C# C#  Datagridview 

 1 Reply(s)
 315  View(s)
Rate this:
we want to insert data in datagridview from text box c#. how to do this please help me.

aditya kumar Patel

Total Post:250

Posted on    February-08-2016 10:45 PM

here we are going to insert data in datagridview from text box dynamically using c# code windows application.
we are provide demo code and design.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsForums
public partial class FORUM : Form
public FORUM()
DataTable dt = new DataTable();

private void FORUM_Load(object sender, EventArgs e)
dataGridView1.DataSource = dt;
dataGridView1.Columns[0].Width = 200;
dataGridView1.Columns[1].Width = 300;


private void btnupdate_Click(object sender, EventArgs e)

DataRow dr = dt.NewRow();
dr[0] = txtname.Text;
dr[1] = txtemail.Text;
dataGridView1.DataSource = dt;


Don't want to miss updates? Please click the below button!

Follow MindStick