39 lines
1.4 KiB
VB.net
39 lines
1.4 KiB
VB.net
|
'Noviembre 2005
|
|||
|
'CONDORBS
|
|||
|
|
|||
|
|
|||
|
Public Class clBusqueda
|
|||
|
'clase q me permite realizar una busqueda en una columna
|
|||
|
Public Function buscarRegistro(ByVal prmPos As Integer, ByVal NombreDataset As String, ByVal NombreCampo As String, ByVal DS As DataSet) As Integer
|
|||
|
'Dim prmPos As Integer
|
|||
|
'C<>digo para buscar un registro
|
|||
|
DS.Copy()
|
|||
|
Dim BuscarValor As String
|
|||
|
Try
|
|||
|
Dim dvCatClientes As DataView = _
|
|||
|
New DataView(DS.Tables(NombreDataset), "", NombreCampo, DataViewRowState.CurrentRows)
|
|||
|
|
|||
|
'Preguntamos el valor a buscar
|
|||
|
BuscarValor = InputBox("Introduce un valor a buscar del campo: " & NombreCampo, "Buscar")
|
|||
|
If Not BuscarValor = "" Then
|
|||
|
'Regresamos el index del valor encontrado
|
|||
|
'Return dvCatClientes.Find(BuscarValor)
|
|||
|
Exit Function
|
|||
|
Else
|
|||
|
'Si no se especific<69> el valro a buscar, regresamos la
|
|||
|
'posici<63>n (index) del valor original(prmPos)
|
|||
|
MessageBox.Show("La b<>squeda no se puede realizar", "Informaci<EFBFBD>n del sistema", MessageBoxButtons.OK, MessageBoxIcon.Information)
|
|||
|
Return prmPos
|
|||
|
Exit Function
|
|||
|
End If
|
|||
|
Catch ex As Exception
|
|||
|
MsgBox(ex.Message)
|
|||
|
Return prmPos
|
|||
|
Exit Function
|
|||
|
End Try
|
|||
|
End Function
|
|||
|
|
|||
|
|
|||
|
|
|||
|
End Class
|