
10/08/2008, 22:45
|
 | | | Fecha de Ingreso: febrero-2003 Ubicación: Sarasota FL
Mensajes: 147
Antigüedad: 22 años, 1 mes Puntos: 0 | |
Respuesta: combobox a un datagridview Estimado Rsilva:
Creo que lo mejor en ese caso es colocar un combobox dentro del Datagridview
En las tareas del datagrid edita las columnas, ahi cambias el default del columtype a DataGridViewComboBoxColumn. Le das un nombre acorde y luego un codigo donde Col2Cb.Items.Add(xy) es del tipo Ccombobox.
Private Sub DataGridView1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
Dim nindice As Integer = Col1Cb.DataGridView.CurrentRow.Index
Dim nvalor As Integer = Col1Cb.DataGridView.Rows(nindice).Cells(0).Value.T oString
comm.CommandText = "Select Stock, Precio From Producto Where IdProducto = '" & nvalor.ToString.Trim & "'"
DR = comm.ExecuteReader
DR.Read()
Dim nStock As Integer = DR.GetString(0)
Dim nPRecio As Integer = DR.GetString(1)
Me.DataGridView1.Item(2, nindice).Value = nPRecio
For xy As Integer = 1 To nStock
Col2Cb.Items.Add(xy)
Next
TotalVenta()
DR.Close()
End Sub
Espero te sirva.
Saludos. |