Visual Basic - enlazar text box con Datagrid

Life is soft - evento anual de software empresarial
 
Vista:

enlazar text box con Datagrid

Publicado por carla (104 intervenciones) el 26/08/2002 17:53:58
hola tengo un datagrid que muestra datos de una tabla ahora coloque un text box y a medida que me van ingresando palabras en ese text box me tiene que buscar la el datagrid alguien tiene un ejemplo
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:enlazar text box con Datagrid

Publicado por Manuel (87 intervenciones) el 26/08/2002 20:10:45
Utiliza en evento Change del campo por el cual esta filtrando
Private Sub txtNombres_Change()
Dim Msg, Estilo, Título
Dim rsSelect_ByAlfa As ADODB.Recordset
Set rsSelect_ByAlfa = New ADODB.Recordset
xSelect = "SELECT * FROM CONSEJERA "
xSelect = xSelect & " WHERE NOMBRE >= '" & Trim(txtNombres) & " '"
xSelect = xSelect & " ORDER BY NOMBRE "
On Error GoTo rsError_Handler
With rsSelect_ByAlfa
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
.LockType = adLockPessimistic
.Open xSelect, cn
End With
'---
On Error GoTo rsError_Handler
Set DataGrid.RecordSource = rsSelect_ByAlfa
' Vuelve a cargar el Grid
Exit Sub

rsError_Handler:
'Si ocurre un error.
Msg = Str(Err.Number) & " " & Err.Description
Estilo = vbCritical + vbOKOnly
Título = "Error"
MsgBox Msg, Estilo, Título
Exit Sub
End Sub

Saludos desde Lima
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar