
teclas direccionales
Publicado por hitlman (5 intervenciones) el 15/07/2015 01:26:15
hola necesito su ayuda
estoy realizando una filtrado en un textbox y el resultado se
muestra en un msflexgrid despues de filtrar encuentra la fila y pone de color plomo
lo que deseo es que despues de filtrar utilizar las teclas dirrecionales
y mover el foco seleccionado(fila de color plomo )
Dim dbconex As New Connection
Dim rs As New Recordset
Dim ST As String
Private Sub Form_Load()
dbconex.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Escritorio\bd1.mdb;Persist Security Info=False"
ST = "Select * from lista "
rs.Open ST, dbconex, adOpenStatic, adLockOptimistic
Set Me.MSHFlexGrid1.DataSource = rs
Me.Label1 = rs.RecordCount
End Sub
Private Sub MSHFlexGrid1_Click()
Me.MSHFlexGrid1.SetFocus
Me.Text1.Text = MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 1)
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
Me.Label1 = rsConex.RecordCount
If Me.MSHFlexGrid1.Row = 0 Then
Me.Text1.Text = Empty
Exit Sub
End If
Call llamar
With MSHFlexGrid1
'.ColWidth(0) = 1100
'.ColWidth(1) = 2000
'.ColWidth(2) = 2000
.ColWidth(3) = 2000
'.ColWidth(4) = 1000
'.ColWidth(5) = 1000
End With
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 .Cols - 1
If MSHFlexGrid1.TextMatrix(i, 1) = txtbusqueda Then
.CellBackColor = &HC0C0C0
.Col = j
.Row = i
' PONE EL COLOR ROJO EN LA FILA
End If
Next j
Next i
End With
Exit Sub
End Sub
End Sub
Valora esta pregunta


0