//I am using Main form as MDI form and named graduation form as inherited form of that.I am passing layer name,tablename from main form to graduation form.I am using usercontrol themeview in main form which store the added layers with index. //this is code of main form when i click on graduation button from main form private void graduation_Click(object sender, EventArgs e) { // call to method GradFeatures(((LayerOverlay)winformsMap1.Overlays[0]).Layers[selectedOrder] as FeatureLayer); } private void GradFeatures(FeatureLayer layer) { if (layer != null) //layer is selectedlayer { if (Graduation == null) { Graduation = new graduation(); } if (symbology_btn.Checked == false) { //Each layer added in themeview usercontrol has index given by selectorder //I am storing file name of selected ordered layer in string name 'filename' filename = themeview1.Items[selectedOrder].ShapeName; Graduation.TableName = Path.GetFileNameWithoutExtension(layer.Name); Graduation.ShapeFileLayer = layer; Graduation.gradlist = filename; Graduation.MdiParent = this; Graduation.Parent = winformsMap1; //inhering winformMapcontrol where layer gonna be display Graduation.Show(); //show graduation form } else //if no layer selected MessageBox.Show("no layer selected"); } ---------------------------------end of main form code----------------------------------------- ------------------------start of gradutaion form code------------------------------------------ // namespace WindowsFormsApplication2 { public partial class graduation : Form { private FeatureLayer shapeFileLayer; private string tableName; private string layer; private string layername; private string filename; private string gradlayer; private Collection file; private int index; private string columnfield; private int total; private int countfield; private ShapeFileFeatureLayer layerfile; LayerOverlay layerOverlay2 = new LayerOverlay(); public string gradlist { get { return gradlayer; } set { txt_layer.Text = value; } } public string TableName { get { return tableName; } set { tableName = value; } } public FeatureLayer ShapeFileLayer { get { return shapeFileLayer; } set { shapeFileLayer = value; } } public graduation() { InitializeComponent(); } private void graduation_Load(object sender, EventArgs e) { layer = txt_layer.Text; //txt_layer is textbox which shows the name of selected layer layername = new FileInfo(layer).Name; filename = Path.ChangeExtension(layername, ".DBF"); layerfile = new ShapeFileFeatureLayer(filename); layerfile.Open(); //opening of shapefile file = layerfile.QueryTools.GetColumns(); //get all coulmns in collection file int cnt = file.Count; //get total number of coulmn fields for (int fieldindex = 0; fieldindex < cnt; fieldindex++) { //Add those column names in combobox named 'cmb_gradselectfiled cmb_gradselctfiled.Items.Add(file.ElementAt(fieldindex)); } layerfile.Close(); } private void btn_add_Click(object sender, EventArgs e) { list_fieldfinal.Items.Add(list_fields.SelectedItem); } private void cmb_gradselctfiled_SelectedIndexChanged(object sender, EventArgs e) { TextBox fieldtext = new TextBox(); columnfield = cmb_gradselctfiled.SelectedItem.ToString(); fieldtext.AppendText("SELECT "); fieldtext.AppendText(columnfield); fieldtext.AppendText(" FROM "); fieldtext.AppendText(TableName); // ShapeFileFeatureLayer layerfile = new ShapeFileFeatureLayer(filename); //layerfile.Open(); shapeFileLayer.Open(); DataTable dataTable = shapeFileLayer.QueryTools.ExecuteQuery(fieldtext.Text); foreach(DataRow rowcollection in dataTable.Rows) { //list_fields.Items.Add(rowcollection); double nam = rowcollection.Field(columnfield); list_fields.Items.Add(nam); } shapeFileLayer.Close(); } private void btn_Result_Click(object sender, EventArgs e) { WinformsMap winformsMap1 = (WinformsMap)this.Parent; layerfile = new ShapeFileFeatureLayer(layername); //shape file name ClassBreakStyle classBreakStyle = new ClassBreakStyle(columnfield); layerfile.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(classBreakStyle); layerfile.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; classBreakStyle.ClassBreaks.Add(new ClassBreak(0, PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.LightPink, 8))); classBreakStyle.ClassBreaks.Add(new ClassBreak((Double)list_fieldfinal.Items[0], PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Pink, 8))); classBreakStyle.ClassBreaks.Add(new ClassBreak((Double)list_fieldfinal.Items[1], PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Red, 8))); classBreakStyle.ClassBreaks.Add(new ClassBreak((Double)list_fieldfinal.Items[2], PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.DarkRed, 8))); classBreakStyle.ClassBreaks.Add(new ClassBreak(5000, PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.Aquamarine, 8))); MessageBox.Show("lclass" + columnfield); LayerOverlay layerOverlay1 = new LayerOverlay(); layerOverlay1.Layers.Add(layerfile); winformsMap1.Overlays.Add(layerOverlay1); winformsMap1.Refresh(); } } }