2009-09-17 58 views
0

我在vb.net datagridview中有一個組合框列。我想要執行一些驗證,比如將一些值放入DataGridView中組合框的selectionindexchanged事件上的Grid的另一個文本列中。但無法這樣做。任何幫助讚賞。提前致謝。GridView中的selectionindexchange事件

回答

0

落實CellEndEdit情況下,選擇的列開關,再抹上細胞對的DataGridViewComboBoxCell對象,並設置要更改單元格的值...

DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)this.dataGridIneligibleReports.Rows[e.RowIndex].Cells[e.ColumnIndex]; 
            this.dataGrdReconciliations.Rows[e.RowIndex].Cells["NameOfTheCellToChange"].Value = cell.Value.ToString(); 

對不起它在C#。

由元騎士轉換..

Dim cell As DataGridViewComboBoxCell = CType(Me.dataGridIneligibleReports.Item(e.ColumnIndex,e.RowIndex), DataGridViewComboBoxCell) 
Me.dataGrdReconciliations.Item("NameOfTheCellToChange", e.RowIndex).Value = cell.Value.ToString() 
+0

我很感激,如果你請我提供vb.net代碼 – 2009-09-17 09:47:20

+0

我敢肯定,你可以工作它:) – bleeeah 2009-09-17 10:24:13

+0

我在我的答案中將代碼轉換爲VB。 bleeeah,如果你把它複製到你的答案中,我會刪除我的。 – 2009-09-17 12:52:44

0

bleeeah的代碼轉換爲VB:

Dim cell As DataGridViewComboBoxCell = CType(Me.dataGridIneligibleReports.Item(e.ColumnIndex,e.RowIndex), DataGridViewComboBoxCell) 
Me.dataGrdReconciliations.Item("NameOfTheCellToChange", e.RowIndex).Value = cell.Value.ToString()