Autofill

To Autofill the TextBox by passing the parameters
-----------------------------------------------


Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
Dim FindString As String
If Asc(e.KeyChar) = Keys.Escape Then
ComboBox1.SelectedIndex = -1
ComboBox1.Text = ""
ElseIf Asc(e.KeyChar) = Keys.Back Then
If ComboBox1.Text.Length > 0 Then
ComboBoxAutoComplete(ComboBox1, ComboBox1.Text.Remove(ComboBox1.Text.Length - 1, 1))
End If
Else
ComboBoxAutoComplete(ComboBox1, ComboBox1.Text)
End If
e.Handled = True
End Sub

Private Sub ComboBoxAutoComplete(ByVal combo As ComboBox, ByVal str As String)
Dim index As Integer
If str.Length = 0 Then
combo.SelectedIndex = -1
combo.Text = ""
Else
index = combo.FindString(str)
If index <> -1 Then
combo.SelectedIndex = index
combo.SelectionStart = str.Length
combo.SelectionLength = combo.Text.Length - combo.SelectionStart
End If
End If
End Sub


Comments

Guest Author: viral31 Jan 2013

I have an application for in that i am doing the criteria of remember me.. But the value is not auto filling in text box any suggestions.
Thanks For Help

Guest Author: viral31 Jan 2013

i have an application for in that i am doing the criteria of remember me.. But the value is not auto filling in text box any suggestions.......Thanks For Help



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: