public class Form1
{
private void Form1_Load(System.Object sender, System.EventArgs e)
{
TableData td = new TableData();
td.Owner = "Frank Lloyd Wright";
td.Pet = "Cow";
td.PetName = "Felix";
TableData td2 = new TableData();
td2.Owner = "George Washington";
td2.Pet = "Dog";
td2.PetName = "Monty";
TableData td3 = new TableData();
td3.Owner = "Carl Sandburg";
td3.Pet = "Frog";
td3.PetName = "County";
TableData[] arr = new TableData[4];
arr[0] = td;
arr[1] = td2;
arr[2] = td3;
DataGridView1.DataSource = arr;
//autoresize each column
DataGridView1.AutoResizeColumn(0);
DataGridView1.AutoResizeColumn(1);
DataGridView1.AutoResizeColumn(2);
}
}