Hola, tengo una datagridview que selecciona de una BD my sql los datos, yo cambio una columna por un combobox [para la modalidad] pero por alguna razon en la 3ra fila el combo no funciona.
Este es mi código...
De antemano gracias por la ayuda.
Private Sub Load3B()
Dim SQL As String
Dim con As MySqlConnection
Try
con = New MySqlConnection(sConnectionMySql)
con.Open()
SQL = "SELECT `Id`, `IdEmpleado`, `Modalidad`, `Entidad Educativa`, `Horas o anos aprobados`, `Fecha de terminacion`, `Certificado con Diploma`, `Graduado`, `Titulo Obtenido`, `Tarjeta profesional No`, `Fecha de expedicion` FROM `05_Academica` WHERE `IdEmpleado` =" & EmpleadoActual
adap3B = New MySqlDataAdapter(SQL, con)
ds3B = New System.Data.DataSet()
adap3B.Fill(ds3B, "Academica")
DataGridView3B.DataSource = ds3B.Tables(0)
DataGridView3B.Columns("Id").Visible = False
DataGridView3B.Columns("IdEmpleado").Visible = False
Catch ex As Exception
MessageBox.Show("Error \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Write3B()
If TodoOk3B() Then
Dim cmddbl As MySqlCommandBuilder
Try
cmddbl = New MySqlCommandBuilder(adap3B)
adap3B.Update(ds3B, "Academica")
'MessageBox.Show("Information updated", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show("Error \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
End Sub
Private Function TodoOk3B() As Boolean
TodoOk3B = True
End Function
Private Sub DataGridView3B_CellEnter(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView3B.CellEnter
On Error Resume Next
Dim comboCell As DataGridViewComboBoxCell
Dim checCell As DataGridViewCheckBoxCell
Select Case DataGridView3B.CurrentCell.ColumnIndex
Case 2 ' Modalidad
DataGridView3B.Rows(e.RowIndex).Cells(e.ColumnIndex).Dispose()
comboCell = New DataGridViewComboBoxCell
comboCell.Items.Add("Primaria")
comboCell.Items.Add("Bachillerato")
comboCell.Items.Add("Universitario")
comboCell.Items.Add("Tecnológica")
comboCell.Items.Add("Técnica")
comboCell.Items.Add("Curso")
comboCell.Items.Add("Taller")
comboCell.Items.Add("Seminario")
comboCell.Items.Add("Congreso")
comboCell.Items.Add("Simposio")
comboCell.Items.Add("Diplomado")
comboCell.Items.Add("Postgrado")
comboCell.Items.Add("Maestría")
DataGridView3B.Rows(e.RowIndex).Cells(e.ColumnIndex) = comboCell
Case 6 ' Certificado con diploma
DataGridView3B.Rows(e.RowIndex).Cells(e.ColumnIndex).Dispose()
checCell = New DataGridViewCheckBoxCell
DataGridView3B.Rows(e.RowIndex).Cells(e.ColumnIndex) = checCell
Case 7 'Graduado
DataGridView3B.Rows(e.RowIndex).Cells(e.ColumnIndex).Dispose()
checCell = New DataGridViewCheckBoxCell
DataGridView3B.Rows(e.RowIndex).Cells(e.ColumnIndex) = checCell
End Select
On Error GoTo 0
End Sub