How can I program a textbox so that when I double-click it, I fill it in with BD information?


Recently I got involved in a project and I have a doubt, if it is possible (and if it is how?) to be able to program a textbox that when writing an information and giving it double click on that same textbox auto complete the information referring to the database of other textbox .


I have two textbox , one for IDAlumno and one for Name .

In one I put the IDAlumno , having finished writing that ID and when I double-clicked it, I completed the textbox of Name , with the name of the person referring to that ID

The code is like this, create for the autocomplete

Sub autocompletarTextbox(ByVal campoTexto As TextBox)
        comando = New SqlCommand("SELECT IDAlumno from Alumno", conexion)
        respuesta = comando.ExecuteReader()
        While respuesta.Read

        End While
    Catch ex As Exception

    End Try

End Sub 

and in the load simply call the function passing as parameter my textbox

autocompleteTextbox (CountNumber)

asked by Celeste Guerra 28.11.2018 в 23:15

0 answers