2010-09-22 26 views
0

我有一個DataGridView窗體。DataGridViewLinkColumn單元格不能寫鏈接winforms

RMShyperlink = new System.Windows.Forms.DataGridViewLinkColumn(); //create a link column column 
dataGridView1.Columns.Add(RMShyperlink); //add to my datagrid 


for(int i =0 ; i < dataGridView1.Rows.Count; i++) 
{ 
    dataGridView1.Rows[i].Cells[0].Value = "http://localhost"; //i set the value 

    //but the value is null when I inspect it 
} 

我該如何寫一個值給單元格?

回答

0

必須有更多的信息引起這一點。如果將DataGridView拖放到表單上並將此代碼放入Form_Load事件中,則代碼可以正常工作。

在DataGridView中您還沒有提到其他的設置嗎?你在使用數據綁定還是其他的東西?

+0

我可以更改文本字段的值,但不是具有類型爲DataGridViewLinkColumn的列中的單元格 – 0x4f3759df 2010-09-22 22:29:29

+0

我明白了。我是說我無法在你身邊複製你的問題。我粘貼上面的代碼,並沒有看到任何問題設置鏈接列中的值。您的DataGridView上設置了哪些其他設置? – msergeant 2010-09-23 01:18:42

相關問題