
msflexgrid keydowun/keyup
Publicado por hbk (5 intervenciones) el 01/06/2013 01:27:24
tengo un texbox donde hago un filtrado ingreso el nombre y aparece
la fila encontrada .lo que deseo es desplazarme con las teclas arriba/abajo
despues de hacer la busqueda
cuando el msflesgrid tiene el foco haciendo click ,solo ahi se desplaza la fila resaltada
con las teclas direccionales
deseo desplazarme en el msflexgrid despues de hacer el filtrado
Dim dbconex As New Connection
Private Sub Form_Load()
dbconex.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\AZUCENA\Escritorio\kgv\bd1.mdb;Persist Security Info=False"
Me.MSHFlexGrid1.SelectionMode = flexSelectionByRow
End Sub
Private Sub MSHFlexGrid1_SelChange()
On Error Resume Next
Me.MSHFlexGrid1.Refresh
Me.MSHFlexGrid1.TopRow = 1
Me.MSHFlexGrid1.RowSel = Me.MSHFlexGrid1.Row
Me.Text1.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1)
End Sub
Private Sub txtbusqueda_Change()
Dim rsConex As New Recordset
Dim strSQL As String
strSQL = "Select * from lista Where nombre like '" + Trim(txtbusqueda) & "%' "
rsConex.Open strSQL, dbconex, adOpenStatic, adLockBatchOptimistic
Set Me.MSHFlexGrid1.DataSource = rsConex
If Me.MSHFlexGrid1.Row = 0 Then
Me.Text1.Text = Empty
Exit Sub
End If
Call llamar
End Sub
Sub llamar()
On Error Resume Next
Dim i As Integer
Dim j As Integer
Me.Text1.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1)
With MSHFlexGrid1
For i = 0 To 4
For j = 0 To 4
If MSHFlexGrid1.TextMatrix(i, 1) = txtbusqueda Then
.Col = j
.Row = i
Me.MSHFlexGrid1.FocusRect = flexFocusNone
Me.MSHFlexGrid1.HighLight = flexHighlightWithFocus
Me.MSHFlexGrid1.SelectionMode = flexSelectionByRow
Me.MSHFlexGrid1.FocusRect = flexFocusNone
' PONE EL COLOR ROJO EN LA FILA
.CellBackColor = &HC0C0C0
End If
Next j
Next i
End With
End Sub
la fila encontrada .lo que deseo es desplazarme con las teclas arriba/abajo
despues de hacer la busqueda
cuando el msflesgrid tiene el foco haciendo click ,solo ahi se desplaza la fila resaltada
con las teclas direccionales
deseo desplazarme en el msflexgrid despues de hacer el filtrado
Dim dbconex As New Connection
Private Sub Form_Load()
dbconex.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\AZUCENA\Escritorio\kgv\bd1.mdb;Persist Security Info=False"
Me.MSHFlexGrid1.SelectionMode = flexSelectionByRow
End Sub
Private Sub MSHFlexGrid1_SelChange()
On Error Resume Next
Me.MSHFlexGrid1.Refresh
Me.MSHFlexGrid1.TopRow = 1
Me.MSHFlexGrid1.RowSel = Me.MSHFlexGrid1.Row
Me.Text1.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1)
End Sub
Private Sub txtbusqueda_Change()
Dim rsConex As New Recordset
Dim strSQL As String
strSQL = "Select * from lista Where nombre like '" + Trim(txtbusqueda) & "%' "
rsConex.Open strSQL, dbconex, adOpenStatic, adLockBatchOptimistic
Set Me.MSHFlexGrid1.DataSource = rsConex
If Me.MSHFlexGrid1.Row = 0 Then
Me.Text1.Text = Empty
Exit Sub
End If
Call llamar
End Sub
Sub llamar()
On Error Resume Next
Dim i As Integer
Dim j As Integer
Me.Text1.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1)
With MSHFlexGrid1
For i = 0 To 4
For j = 0 To 4
If MSHFlexGrid1.TextMatrix(i, 1) = txtbusqueda Then
.Col = j
.Row = i
Me.MSHFlexGrid1.FocusRect = flexFocusNone
Me.MSHFlexGrid1.HighLight = flexHighlightWithFocus
Me.MSHFlexGrid1.SelectionMode = flexSelectionByRow
Me.MSHFlexGrid1.FocusRect = flexFocusNone
' PONE EL COLOR ROJO EN LA FILA
.CellBackColor = &HC0C0C0
End If
Next j
Next i
End With
End Sub
Valora esta pregunta


0