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
.
Example:
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)
Try
conexion.Open()
comando = New SqlCommand("SELECT IDAlumno from Alumno", conexion)
respuesta = comando.ExecuteReader()
While respuesta.Read
campoTexto.AutoCompleteCustomSource.Add(respuesta.Item("IDAlumno"))
End While
respuesta.Close()
Catch ex As Exception
End Try
End Sub
and in the load simply call the function passing as parameter my textbox
autocompleteTextbox (CountNumber)