-
June 30th, 2010, 05:15 AM
#1
Textbox autocomplete string collection Help
Dear Expert,
I have made taken one textbox in form, in which i have written following logic in Got Focus event.
When i focus on that its automatically showing all the suggested name from database field.
CODE:-
Code:
Private Sub CustomerName_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CustomerName.GotFocus
da = New SqlDataAdapter("Select CustomerName from CustomerMaster", myConnection)
da.Fill(ds, "CustomerMaster")
Dim acFirstName As New AutoCompleteStringCollection
For Each dr As DataRow In Me.ds.Tables("CustomerMaster").Rows
acFirstName.Add(dr.Item("CustomerName").ToString)
Next
CustomerName.AutoCompleteCustomSource = acFirstName
End Sub
I want that if suppose, i will type some other name which is not exist in autocomplete string collection then its should gives error.
Please guide me.
Regards,
AKM
-
July 1st, 2010, 01:23 AM
#2
Re: Textbox autocomplete string collection Help
What I would do is to loop through the items in the listbox array ( most likely on each key press ), then if there is no match found produce the error message. You can find if certain strings match by simple string manipulation techniques. There is a FAQ about string manipulation here :
http://www.codeguru.com/forum/forumdisplay.php?f=93
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|