if(item.find(a)!=null)
{
throw new Exception(string.Format("指定的商品 {0} {1} 已经添加在列表中。", A, B));
}
这句代码提示出来的是个空白的消息框子
A和B分别都有值。
if判断没错,但只要一进去,无论输出什么都是直接在页面弹出一个白色消息框子,一个确定按钮,按确定却也关不掉这个消息框子。
其他地方的throw new Exception输出没错。
{
throw new Exception(string.Format("指定的商品 {0} {1} 已经添加在列表中。", A, B));
}
这句代码提示出来的是个空白的消息框子
A和B分别都有值。
if判断没错,但只要一进去,无论输出什么都是直接在页面弹出一个白色消息框子,一个确定按钮,按确定却也关不掉这个消息框子。
其他地方的throw new Exception输出没错。
如果我放在if外面就没错。。
换过放在else中也是一样的结果
{ }
else
{
throw new Exception(string.Format("指定的商品 {0} {1} 已经添加在列表中。", A, B));
}
同样的错。
if(item.find(a)!=null)
{
throw new Exception(string.Format("。。"));
}
同样的错。
让他返回真假,同样进去就出错。
item.find(a))这个方法直接让他返回了true,false同样出错
{
try
{
throw new Exception(string.Format("指定的商品 {0} {1} 已经添加在列表中。", A, B));
}
catch (Exception l)
{
throw new Exception("{0}",l);
}
}
同样错误,出现空白消息框,框子无法关闭。
{ 同时 try catch
在别的if里也正常,就这一个不正常。
{
if (Item.Find(A) != null)
{ throw new Exception(string.Format("指定的商品 {0} {1} 已经添加在列表中。", A, B)); }
}
catch (Exception l)
{
throw new Exception("{0}", l);
}
一样。
for(int i=0;i<item.count;i++)
{
if(item[i].A==A)
{
throw new Exception(string.Format("指定的商品 {0} {1} 已经添加在列表中。", A, B)); }
}
出最后个括号直接出错。
给你们看看这item的循环
{
foreach (Item Item in this)
{
if (Item.A == A)
{
return Item;
}
}
return null;
}结合那判断看下错在哪?
??
{
foreach (ssItem Item in this)
{
if (Item.A == A)
{
return Item;
}
}
return null;
}
{
ssItem s=null;
try {
foreach (ssItem Item in this)
{
if (Item.A == A)
{
s= Item;
break;
}
}
}
catch(Exception e){
s=null;
}
finally{
return s;
}
}
消息=“指定的商品testm诺基亚N90 - 红色已经添加在列表中。”
来源=“App_Web_qzucuwsu”
堆栈跟踪:
在StockEdit.AddButton_Click(对象发送,EventArgs五)在c:\ Documents和Settings \ shanmingjun \我的文档\ Visual Studio 2008的\项目\斯通\源代码\股票\ StockEdit.aspx.cs:行90
的InnerException:
行