How to use Data Grid View Control?
pls send me with Example
Thanks&Regs
Magesh
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
SenthilkumarRank #387 · 6.5K reputationPosted Mar 17, 2012, 12:21 AM EDT
The MSDN have some description about the GridView usage with an example.
http://msdn.microsoft.com/en-us/library/aa479342.aspx
You can find more examples like GridView Binding, edit, update, Loading images, dropdown, etc..,in the following examples.
http://www.dotnetspider.com/resources/Category518-ASP-NET-GridView.aspx
http://www.c-sharpcorner.com/uploadfile/raj1979/gridview-examples-for-Asp-Net-2-0/
http://www.exforsys.com/tutorials/asp.net-2.0/asp.net-2.0-the-gridview-control.html
Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 17, 2012, 2:49 AM EDT
To display data in a datagridview from database.
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;
using System.Data.OleDb;
namespace Datagridview_bind
{
public partial class Form1 : Form
{
string ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["dsn"];
OleDbCommand com;
OleDbDataAdapter oda;
DataSet ds;
string str;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(ConnectionString);
con.Open();
str = "select * from customer";
com = new OleDbCommand(str, con);
oda = new OleDbDataAdapter(com);
ds = new DataSet();
oda.Fill(ds, "customer");
dataGridView1.DataMember = "customer";
dataGridView1.DataSource = ds;
con.Close();
}
}
}
Thanks
Sam HobbsRank #107 · 20.5K reputationPosted Mar 17, 2012, 4:28 PM EDT
Then, after reading some articles, when you need to request assistance in the C# Corner forums, you need to ask the questions in the Windows Forms forum or whatever UI you are using but not the C# Language forum.