public class aa
{
public static void check(string str)
{
bool aa=false;
 if (string.IsNullOrEmpty(str) == true)
            {
               
              //如何中断所有执行?包括被调用的父类
              //这地方如何写啊
                //return;不行,

            }
}
}
public class bb
{
protected void Button1_Click(object sender, EventArgs e)
    {
aa.check(this.text1.text);//目的就是截断下面的操作
...
...
...}
}

解决方案 »

  1.   


    if(aa.check(this.text1.text)==true)
          return;aa.check返回bool值确定是否中断
      

  2.   

    用goto语句试试 return 应该是可以的啊
      

  3.   

    public static void input_check_two(int length, string stringstr, string messge)
            {            if (string.IsNullOrEmpty(stringstr) == true)
                {
                    rayelert.ShowLocation(messge + "不能为空!", "javascript:history.back()", 1);
                    return;
                  //  HttpContext.Current.Response.End();
                }
                else
                {
                    if (stringstr.Length > length)
                    {
                        rayelert.ShowLocation(messge + "输入过多字符!", "javascript:history.back()", 1);
                        return;
                    }
                }
            }
    页面事件
    protected void Button1_Click(object sender, EventArgs e)
        {
            ray_stringedit.input_check_inputty(9, Request.Form["inputjia1"], "最低价格", 1);
      

  4.   


    return不行,我把代码都贴出来了,你看看。它还是能继续往下执行
      

  5.   

    input_check_two中信息应返回给Button1_Click实现提示判断
      

  6.   

    throw new Exception("给我中断!");
      

  7.   

    public static void check(string str)
    {}//这个方法应该返回一个布尔类型
    //应该改成下面的:public static bool check(string str)
    {
    if (string.IsNullOrEmpty(str))
      {
         return false;
      }
      return true;
    }
    //然后在bb类就可以如下:
    if(!(aa.check(this.text1.text)))
    {
       return;
    }
    //目的就是截断下面的操作
      

  8.   

    private void MainsForm_MouseDown(object sender, MouseEventArgs e)
            {
                if (input_check_two(2, "aaaa", "bbbb"))
                {
                    Console.WriteLine("返回为true继续执行操作");
                }
                else
                {
                    Console.WriteLine("提示错误信息");
                }
            }        public static bool input_check_two(int length, string stringstr, string messge)
            {
                bool bl = true;
                if (string.IsNullOrEmpty(stringstr) == true)
                {
                    bl = false;
                    rayelert.ShowLocation(messge + "不能为空!", "javascript:history.back()", 1);
                    // HttpContext.Current.Response.End();
                }
                else
                {
                    if (stringstr.Length > length)
                    {
                        bl = false;
                        rayelert.ShowLocation(messge + "输入过多字符!", "javascript:history.back()", 1);
                    }
                }
                return bl;
            }