2012-07-22 134 views
2

我在窗體上有一個簡單的datagridview。我添加了2列 - 一個按鈕類型和另一個文本類型。我正在嘗試添加一些行,但我沒有看到它們。datagridview添加行

以下是代碼。這一定很簡單,但我需要做什麼才能看到我的新行?

private void Form1_Load(object sender, EventArgs e) 
    { 
     dataGridView1.Rows.Clear(); 
     DataGridViewRow newRow = new DataGridViewRow(); 
     Button button = new Button(); 
     button.Name = "BUTTON"; 
     button.Text="BUTTON"; 
     newRow.SetValues(button, "TEST"); 
     dataGridView1.Rows.Add(newRow); 

    } 

回答