Solved! Go to Solution.
Do you need to return all values or just the ones matching what is being typed in. So when the user types a new letter run a query return only the matching address.
Private Sub AutotbSearch_KeyUp(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles AutotbSearch.KeyUp If AutotbSearch.Text.Length > 2 Then LoadGISData() Else Return End If End Sub
Public Sub LoadGISData() Dim queryTaskAddress As New QueryTask("http://xxxxxxxx/xxxxxxxx/rest/services/ElectionData/MapServer/0") AddHandler queryTaskAddress.ExecuteCompleted, AddressOf QueryTaskAddress_ExecuteCompleted AddHandler queryTaskAddress.Failed, AddressOf QueryTaskAddress_Failed Dim searchText As String = AutotbSearch.Text Dim Addressquery As Query = New Query() Addressquery.ReturnGeometry = True Addressquery.OutFields.Add("PHYADDR1") Addressquery.Where = String.Format("PHYADDR1 LIKE '%{0}%'", searchText) queryTaskAddress.ExecuteAsync(Addressquery) End Sub
Private Sub QueryTaskAddress_ExecuteCompleted(ByVal sender As Object, ByVal args As ESRI.ArcGIS.Client.Tasks.QueryEventArgs) AddressfeatureSet = args.FeatureSet AddressList.Clear() Dim AddressValue As String For Each Feature As Graphic In AddressfeatureSet AddressValue = Feature.Attributes.Item("PHYADDR1").ToString AddressList.Add(AddressValue) Next AutotbSearch.ItemsSource = AddressList End Sub