try
{
  aa;
}
catch
{}
如果语句aa出错到catch里,再将aa执行一遍,如果还报错再运行一遍,判断三遍后就return
怎摸写好呢?还得用 timer吗?

解决方案 »

  1.   

    我觉得可以用循环或者跳转,循环比较好。for(int i=0;i<3;i++)
    {
     try 
      { 
      aa; 
      } 
     catch 
     {  } }
    return;有待测试哈。
      

  2.   

    int i=0;
    bool blnOK=false;
    while (!blnOK)
    {
    try 

      aa; 
      blnOK=true;

    catch 

    i++;
    if(i==3) blnOK=true;
    }}
      
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) 
    http://feiyun0112.cnblogs.com/
      

  3.   

    try 

      aa; 

    catch 

       try 
       { 
          aa; 
       } 
       catch 
       {
          aa;
       }
       finally
       {
         return aa;
       }

      

  4.   

    try 

      aa(); 

    catch(Execption ex)

    if(count==3){
       retrun;
    }
    else if(ex.Message=="aa error")
    {
       aa();
    count++
    }
    else
    {
       throw ex;
    }
    } int count=0;
    private void aa()
    {
    //ToDo
    try{
    }catch(Execption e)
    {
       Throw new Execption("aa error");
    }
     count++  
    }
      

  5.   

    用循环试试
    int i=0;
     while(i<3)
    {
       try 
       { 
         aa; 
         break;//正确执行跳出循环
       } 
       catch 
      { 
       i+=1;
      } 
    }