觉得红色字体有问题。
直接调用this.open()可以了吧

解决方案 »

  1.   

    open() 是在单独的类中,所以
     abc a = new abc(); 
            a.open(); 
    应该不是这个问题
      

  2.   

    private Timer ti;定义在哪里?如果在Global里面,那么你在abc如何饮用得到?如果在abc里面, abc的生命周期只在Application_Start范围内, Application_Start执行完了, abc将会被回收,Timer ti也将会被一起回收掉。修改方法:
    private Timer ti;void Application_Start(object sender, EventArgs e)
        {
            open();    }
    open()
    {
    ti = new Timer();
            ti.Elapsed += new ElapsedEventHandler(ti_Elapsed);
            ti.Enabled = true;
            ti.Interval = 1000;
    }
    private void ti_Elapsed(object sender, ElapsedEventArgs e)
        {
    //任务代码...