Hello-
...I have written some code for a dockwindow where the user enters a name in a textbox which is then passed to a variable. The variable is then used in a search filter which searches the "Name" field from a feature class in a File Geodatabase- which works fine until it comes across a <null> field or an empty string. What I need to do is include a way to catch these errors and prompt the user before the search is executed...any thoughts? Part of my code is below:
'Gets search criteria from text box
Dim namesearch As String
namesearch = TextBox1.Text
'Gets the table associated with the layer.
Dim mapDisplay As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
Dim myMap As Map = MapDisplay.Map
Dim findName As Table = DirectCast(myMap.FindByName("Lots"), FeatureLayer).Table
' The Search method takes a Filter object, which has the SQL query defined in its constructor.
Dim searchName As RowCollection = findName.Search(New Filter("Name LIKE '%" + namesearch + "%';", New String() {"Name", "Lot_Section", "OBJECTID"}))
' RowCollection gets passed to the DataGrid
Dim tba As TableBindingAdapter = New TableBindingAdapter(searchName)
tba.Fill()
Thanks,
-Josh