“System.StackOverflowException”类型的未经处理的异常出现在 System.Windows.Forms.dll 中。
this.ResumeLayout(false);usingSystem;usingSystem.Collections.Generic;usingSystem.Comp...
this.ResumeLayout(false);
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Output;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.DataSourcesRaster;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.Geodatabase;
using System.IO;
namespace 农村土地管理系统
{
public partial class attribute : Form
{
private ILayer layer;
public attribute(ILayer lyr)
{
InitializeComponent();
layer = lyr;
attribute AttributeForm = new attribute(layer);
this.Text = "\"" + layer.Name + "\" 属性表";
}
private void attribute_Load(object sender, EventArgs e)
{
try
{
ITable lyrtable = (ITable)layer;
DataTable table = new DataTable();
IField field;
for (int i = 0; i < lyrtable.Fields.FieldCount; i++)
{
field = lyrtable.Fields.get_Field(i);
table.Columns.Add(field.Name);
}
object[] values = new object[lyrtable.Fields.FieldCount];
IQueryFilter queryFilter = new QueryFilter();
ICursor cursor = lyrtable.Search(queryFilter, true);
IRow row;
while ((row = cursor.NextRow()) != null)
{
for (int j = 0; j < lyrtable.Fields.FieldCount; j++)
{
object ob = row.get_Value(j);
values[j] = ob;
}
table.Rows.Add(values);
}
this.dataGridView1.DataSource = table;
}
catch
{
MessageBox.Show("无法显示属性表!"); this.Close();
}
}
}
}
请问怎么修改啊,急求,谢谢啦 展开
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Output;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.DataSourcesRaster;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.Geodatabase;
using System.IO;
namespace 农村土地管理系统
{
public partial class attribute : Form
{
private ILayer layer;
public attribute(ILayer lyr)
{
InitializeComponent();
layer = lyr;
attribute AttributeForm = new attribute(layer);
this.Text = "\"" + layer.Name + "\" 属性表";
}
private void attribute_Load(object sender, EventArgs e)
{
try
{
ITable lyrtable = (ITable)layer;
DataTable table = new DataTable();
IField field;
for (int i = 0; i < lyrtable.Fields.FieldCount; i++)
{
field = lyrtable.Fields.get_Field(i);
table.Columns.Add(field.Name);
}
object[] values = new object[lyrtable.Fields.FieldCount];
IQueryFilter queryFilter = new QueryFilter();
ICursor cursor = lyrtable.Search(queryFilter, true);
IRow row;
while ((row = cursor.NextRow()) != null)
{
for (int j = 0; j < lyrtable.Fields.FieldCount; j++)
{
object ob = row.get_Value(j);
values[j] = ob;
}
table.Rows.Add(values);
}
this.dataGridView1.DataSource = table;
}
catch
{
MessageBox.Show("无法显示属性表!"); this.Close();
}
}
}
}
请问怎么修改啊,急求,谢谢啦 展开
1个回答
展开全部
你代码无限循环了,你在form1中有new Calculate.Calculate();
然后在Calculate中又有new Form1();最终就是一个无限实例化的循环过程。
其实完全没必要做这做,你的Calculate只是单纯的计算,所以完全可以将public void calculate更改为比如public static string calculate,然后Calculate中也不涉及任何对form1操作,在form1中调用的时候就可以不用实例化Calculate,直接写
textBox1.Text=Calculate.calculate(参数);
然后在Calculate中又有new Form1();最终就是一个无限实例化的循环过程。
其实完全没必要做这做,你的Calculate只是单纯的计算,所以完全可以将public void calculate更改为比如public static string calculate,然后Calculate中也不涉及任何对form1操作,在form1中调用的时候就可以不用实例化Calculate,直接写
textBox1.Text=Calculate.calculate(参数);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
您可能需要的服务
百度律临官方认证律师咨询
平均3分钟响应
|
问题解决率99%
|
24小时在线
立即免费咨询律师
17722人正在获得一对一解答
武汉草原风1分钟前提交了问题
南宁热带风暴6分钟前提交了问题
济南夏日炎炎4分钟前提交了问题