using System; using System.Windows.Forms; using System.Drawing; class ex : Form { DataGridView dgv = new DataGridView(); ex() { Width = 400; dgv.Height = 400; dgv.Width = 400; dgv.ReadOnly = true; dgv.AllowUserToAddRows = false; dgv.ColumnCount = 3; dgv.RowCount = 3; dgv.RowTemplate.Height = 10; dgv.Rows.Add(); dgv.Rows.Add(); Controls.Add(dgv); dgv.Rows[0].Cells[0].Value = "1"; dgv.Rows[0].Cells[1].Value = "John"; dgv.Rows[0].Cells[2].Value = "Smith"; dgv.Rows[1].Cells[0].Value = "2"; dgv.Rows[1].Cells[1].Value = "Jane"; dgv.Rows[1].Cells[2].Value = "Smith"; dgv.Rows[2].Cells[0].Value = "3"; dgv.Rows[2].Cells[1].Value = "Bob"; dgv.Rows[2].Cells[2].Value = "Jones"; } [STAThread] static public void Main() { Application.Run(new ex()); } }