0
中選擇組合項目我在這個問題上尋求幫助。我在論壇中發現了很多問題,但主要是沒有回答,或者有「解決方案」,他們不工作(由其他用戶報告,我也嘗試過)。在Me.MyDataGridView.Rows(myRow).Cells(myCells)
我只是想從加入到datagridview的一個ComboBoxCell值的列表中設置的值,但它總是在「的DataGridViewComboBoxCell值無效」錯誤
我想結束(根據在論壇中回答我發現):
1)
Me.MyDataGridView.Rows(myRow).Cells("myColumn").Value = "MyStringOrValue"
2)
CType(Me.MyDataGridView("MyColumn", Me.MyDataGridView.Rows.Count - 1), DataGridViewComboBoxCell).Value = "MyStringOrValue
3)
cell.Value = cell.Items.Item(1)
4)
Dim cell As DataGridViewComboBoxCell = Me.MyDataGridView.Rows(Me.MyDataGridView.Rows.Count - 1).Cells("MyColumn")
cell.DisplayMember = CType(Me.MyDataGridView.Columns("MyColumn"), DataGridViewComboBoxColumn).DisplayMember
cell.ValueMember = CType(Me.MyDataGridView.Columns("MyColumn"), DataGridViewComboBoxColumn).ValueMember
cell.Value = cell.Items.Item(1)
5)另一個編輯:計數細胞項目工作的,所以這個問題仍然是,它說,這cell.items.item(我)是不是數據類型,明智的可壓性與cell.items什麼 - 這是一個謎,我...
MsgBox("cell items = " & cell.Items.Count)
...返回「6」,因爲它應該
我感謝任何幫助。必須有一種方法來選擇一個項目。
問候,
Libor的
我已經試過這個了,包括一個帶有「cell.Items.Item(1)」的變體。不幸的是,我仍然有同樣的錯誤。我認爲必須先爲DatagridviewcomboboxCell創建或鏈接組合物。 – 2015-04-04 18:05:48