tags:

views:

55

answers:

2

Hi All, I have a combo box column in vb.net datagridview . i want to perform some validation like to put some values in another text column of Grid on selectionindexchanged event of a combo box in datagridview. but unable to do so. Any Help appreciated. Thanks in Advance.

A: 

Implement the CellEndEdit event, switch on the selected column, then cast the cell to a DataGridViewComboBoxCell object and set the value of cell you want to change ...

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

Sorry it's in C#.

Converted by Meta-Knight..

Dim cell As DataGridViewComboBoxCell = CType(Me.dataGridIneligibleReports.Item(e.ColumnIndex,e.RowIndex), DataGridViewComboBoxCell)
Me.dataGrdReconciliations.Item("NameOfTheCellToChange", e.RowIndex).Value = cell.Value.ToString()
bleeeah
i am thankful if you please provide me vb.net code
Faizan Dosani
I'm sure you can work it out :)
bleeeah
I converted the code to VB in my answer. bleeeah, if you copy it into your answer and I'll delete mine.
Meta-Knight
A: 

bleeeah's code converted to VB:

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