private void showResults(DataTable dt) { if (dt.Rows.Count < 1) { System.Windows.Forms.MessageBox.Show("No records were returned from the search.", "Related Party Query: Oops!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); return; } results = new fmRelatedPartyGrid(dt); results.Show(); }
protected override void OnClick() { if (results != null) { try { results.Close(); results = null; } catch { // just move on. int i = 1; } } using (CSpatialSubs oSpatialSubs = new CSpatialSubs()) { // check if taxlots is in the data frame //if (!oSpatialSubs.doesMapLayerExist("MEDSDE.DBO.TAXLOTS", ArcMap.Application)) if (!oSpatialSubs.doesMapLayerExist("MEDSDE.DBO.TAXLOTS", ArcMap.Application)) { System.Windows.Forms.MessageBox.Show("Taxlots layer does not exist." + Environment.NewLine + Environment.NewLine + "Please ensure that you have taxlots loaded into your project and " + Environment.NewLine + "that have your target taxlots selected.", "Related Party Query: Oops!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); return; } IFeatureLayer pFLayer = (IFeatureLayer)oSpatialSubs.returnFeatureLayer(ArcMap.Document.FocusMap, "Tax Lots"); IFeatureSelection pFSel = pFLayer as IFeatureSelection; ISelectionSet2 pSelSet = pFSel.SelectionSet as ISelectionSet2; if (pSelSet.Count < 1) { System.Windows.Forms.MessageBox.Show("There were no selected features found." + Environment.NewLine + Environment.NewLine + "Please select taxlots before using this tool.", "Related Party Query: Oops!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation); return; } ICursor pCursor; pSelSet.Search(null, false, out pCursor); doQuery(returnSearchCriteria(pCursor as IFeatureCursor)); } }