using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.ADF.CATIDs;
using ESRI.ArcGIS.Framework;
using ESRI.ArcGIS.ArcMapUI;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
using System.Data.OleDb;
using System.Data.Common;
namespace Create_Forms
{
public partial class BogsCal : Form
IMxDocument m_mxdoc;
IMap myMap;
string boglayer;
string bogfield;
string tablename;
string tablefield;
public BogsCal(IMxDocument myDoc)
InitializeComponent();
m_mxdoc = myDoc;
popComboBox(m_mxdoc.FocusMap);
myMap = m_mxdoc.FocusMap;
}
public ILayer findLayer(IMap map, string bog)
for (int i = 0; i <= map.LayerCount; i++)
if (map.get_Layer(i).Name == bog)
return map.get_Layer(i);
return null;
public ITable findTable(ITable map, string Table)
IStandaloneTableCollection standalonetablecoll =
(IStandaloneTableCollection)myMap;
for (int i = 0; i < standalonetablecoll.StandaloneTableCount; i++)
string tablename = standalonetablecoll.get_StandaloneTable(i).ToString();
if (tablename == Table)
IStandaloneTable sttable =
standalonetablecoll.get_StandaloneTable(i);
return sttable.Table;
public void popComboBox(IMap map)
for (int i = 0; i < map.LayerCount; i++)
string layername = map.get_Layer(i).Name.ToString();
cbo1.Items.Add(layername);
//cbo1.Items.Add(adds the featurelayers)
private void button1_click(object sender, EventArgs e)
private void combobox4_selectedIndesChanged(object sender, EventArgs e)
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
private void cbo1_SelectedIndexChanged(object sender, EventArgs e)
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
private void BogsCal_Load(object sender, EventArgs e)
//cbo1.Items.Add("map");
boglayer = cbo1.SelectedItem.ToString();
ILayer myLayer = findLayer(myMap, boglayer );
IFeatureLayer myBogFeatLayer = (IFeatureLayer)myLayer;
IFeatureClass myBogFeatureClass = myBogFeatLayer.FeatureClass;