Pregunta: | 10867 - DATAGRID - BUTTON - VB6 |
Autor: | Valeria Oglialoro |
No se como llenar una celda dentro de la grilla (DataGrid) que tiene formato "Button", es decir que se despliegue una serie de items. Muchas gracias por despejar mi duda. |
Respuesta: | Sergio Brillo |
Tienes q usar un truquillo, create un list view con los valores q kieras o los metes bajo codigo y lo pones invisible y haces lo siguiente:
Private Sub DataGrid1_ButtonClick(ByVal ColIndex As Integer) En el numero de columna q tengas el button es el q debes poner en el collindex If ColIndex = 9 Then Set c = DataGrid1.Columns(ColIndex) With List1 'Muestra la lista. .Left = DataGrid1.Left + c.Left .Top = DataGrid1.Top + DataGrid1.RowTop(DataGrid1.Row) + DataGrid1.RowHeight .Width = c.Width + 15 .ListIndex = 0 .Visible = True .ZOrder 0 .SetFocus End With End If End Sub Private Sub List1_KeyPress(KeyAscii As Integer) Select Case KeyAscii Case vbKeyReturn 'Asigma el texto seleccionado. DataGrid1.Columns(9).Text = List1.Text List1.Visible = False Case vbKeyEscape List1.Visible = False End Select End Sub Private Sub List1_LostFocus() 'Oculta la lista al perder el foco List1.Visible = False End Sub Private Sub List1_Click() List1_KeyPress vbKeyReturn End Sub |