What you've done is pretty much OK, you just need to add at the end:
dataGridView1.DataBind();
On 5 Sep, 20:14, asit <[EMAIL PROTECTED]> wrote:
> private void button1_Click(object sender, EventArgs e)
> {
> DataTable Table = null;
> DataRow row1 = null;
> DataRow row2 = null;
> //DataRow row3 = null;
> //DataRow row4 = null;
>
> Table = new DataTable("Employee");
>
> DataColumn FirstName = new DataColumn("First Name");
> FirstName.DataType = System.Type.GetType("System.String");
> Table.Columns.Add(FirstName);
>
> DataColumn Phone = new DataColumn("Phone");
> Phone.DataType = System.Type.GetType("System.String");
> Table.Columns.Add(Phone);
>
> row1 = Table.NewRow();
> row1["First Name"] = "asit";
> row1["Phone"] = "9438305868";
> Table.Rows.Add(row1);
>
> row2 = Table.NewRow();
> row2["First Name"] = "Papu";
> row2["Phone"] = "06742302788";
> Table.Rows.Add(row2);
>
> DataSet ds = new DataSet();
> ds.Tables.Add(Table);
> //DataGrid dg = new DataGrid();
> //dg.SetDataBinding(ds, "Employee");
> dataGridView1.AutoGenerateColumns = true;
> dataGridView1.DataSource = ds;
>
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---