请大家分析一下:一个系统异常:

gordenfl 2003-09-30 10:14:24
未处理的“System.ArgumentOutOfRangeException”类型的异常出现在 system.windows.forms.dll 中

其他信息:索引和长度必须引用该字符串内的位置。
...全文
36 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
gordenfl 2003-09-30
  • 打赏
  • 举报
回复
异常抛出的地方:


Application.Run(new Form1());
} //就在这里...
cdbnzc 2003-09-30
  • 打赏
  • 举报
回复
设断点了吗?从哪里抛出异常呢?
gordenfl 2003-09-30
  • 打赏
  • 举报
回复
谢谢大家!小弟拜托了!
gordenfl 2003-09-30
  • 打赏
  • 举报
回复
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();

//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
gordenfl 2003-09-30
  • 打赏
  • 举报
回复
private void Form1_Load(object sender, System.EventArgs e)
{
Form1.Path = "c:\\";
ss.GetRescueMapping(ref ds3sa1);
cncn.DataSource = ds3sa1.Tables["类型"];
cncn.DisplayMember ="name";
cncn.ValueMember ="value";
//初始化金台信息栏目
ss.GetGMSMapping(ref ds);
for(int i = 0 ;i<ds.Tables["类别"].Rows.Count;i++)
{
ds.Tables[ds.Tables["类别"].Rows[i]["类型名称"].ToString()].Columns.Add("checked",System.Type.GetType("System.String"));
}
checkedListBox2.DataSource = ds.Tables["类别"].DefaultView ;
checkedListBox2.DisplayMember ="类型名称";
checkedListBox2.ValueMember ="代码";

checkedListBox3.Visible = false;
ss.GetGQSMapping(ref ds1);
//ds1.ReadXml(@"Mapping\GQS.xml");
for(int i = 0 ;i<ds1.Tables["类别"].Rows.Count;i++)
{
ds1.Tables[ds1.Tables["类别"].Rows[i]["类型名称"].ToString()].Columns.Add("checked",System.Type.GetType("System.String"));
}
checkedListBox1.DataSource = ds1.Tables["类别"].DefaultView ;
checkedListBox1.DisplayMember ="类型名称";
checkedListBox4.Visible = false;

}
Soking 2003-09-30
  • 打赏
  • 举报
回复
当调用某个方法时,如果在传递给该方法的参数中至少有一个不为空引用(Visual Basic 中为 Nothing)且不包含有效值,则将引发 ArgumentOutOfRangeException。
lyrixliu 2003-09-30
  • 打赏
  • 举报
回复
把form1的load的代码铁出来,目前这样无从下手
维她奶 2003-09-30
  • 打赏
  • 举报
回复
把程序贴出来好吗?
bencalie 2003-09-30
  • 打赏
  • 举报
回复
检查Form1的构造函数
herofyf 2003-09-30
  • 打赏
  • 举报
回复
后来我就重启动了一下程序,或者直接运行exe文件就没有了!
gordenfl 2003-09-30
  • 打赏
  • 举报
回复
但是我根本不知道这个异常出现在什么地方!
系统停留在,


Application.Run(new Form1());
} //就在这里...
saucer 2003-09-30
  • 打赏
  • 举报
回复
you are using String.Substring() method and the length is larger than Length of the String, try

string s= "....";
string s2 = s.Length > 20? s.Substring(0,20) : s;
zag 2003-09-30
  • 打赏
  • 举报
回复
索引值大于Length-1或者索引值+检索字符长度大于Length。
cdbnzc 2003-09-30
  • 打赏
  • 举报
回复
ds3sa1.Tables["类型"]
ds.Tables["类别"]
确认是这样?一个是类型一个是类别?
cdbnzc 2003-09-30
  • 打赏
  • 举报
回复
ds.Tables["类别"]
确认字段名是“类别”?
gordenfl 2003-09-30
  • 打赏
  • 举报
回复
不为空!
linaren 2003-09-30
  • 打赏
  • 举报
回复
确认ds或ds1不为空

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧