当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 我在《asp.net web服务高级编程》中看到web服务的url地址可以在运行时修改,使得代理类变得更加灵活。书上是在asmx文件中的构造函数中写入代码实现的。 如:this.url = "http://localhost/......" 可是我在学时,并没有this.url这么一个属性呀,不知道这是怎么一回事,我应该怎么做呢? ......
    摘要: 用openconnection来抓取url的内容的时候,有时候web server响应慢的话这个方法就会死在那里。有没有办法主动的中断这个方法? ......


求助:初学者的问题

我在TForm中定义了一个类,但是调用就出错,好奇怪  
  unit   Unit1;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,  
      Dialogs,   StdCtrls;  
   
  type  
      TForm1   =   class(TForm)  
          Button1:   TButton;  
          procedure   Button1Click(Sender:   TObject);  
      private  
          {   Private   declarations   }  
      public  
          {   Public   declarations   }  
      end;  
   
  type  
      filerecord=class  
      procedure   keep(var   line1,color1,count1:integer);  
      procedure   Create();  
      private  
      public  
      color,line,count:integer  
    end;  
  var  
      Form1:   TForm1;  
      a:filerecord;  
   
  implementation  
   
  procedure   filerecord.Create();  
  begin  
        line:=0;  
        count:=0;  
        color:=0;  
  end;  
  procedure   filerecord.keep(var   line1,color1,count1:integer);  
  begin  
        line:=line1;  
        count:=count1;  
        color:=color1;  
  end;  
  {$R   *.dfm}  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
                a.Create();  
   
  end;  
   
  end.  
 

NO.1   作者: hotzhu

procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
                a   +   filerecord.Create();  
   
  end;

NO.2   作者: madyak

unit   Unit1;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,  
      Dialogs,   StdCtrls;  
   
  type  
      TForm1   =   class(TForm)  
          Button1:   TButton;  
          procedure   Button1Click(Sender:   TObject);  
      private  
          {   Private   declarations   }  
      public  
          {   Public   declarations   }  
      end;  
   
  type  
      filerecord=class  
      procedure   keep(var   line1,color1,count1:integer);  
      constructor   Create();//*********  
      private  
      public  
      color,line,count:integer  
    end;  
  var  
      Form1:   TForm1;  
      a:filerecord;  
   
  implementation  
   
  constructor   filerecord.Create();//**********  
  begin  
        line:=0;  
        count:=0;  
        color:=0;  
  end;  
  procedure   filerecord.keep(var   line1,color1,count1:integer);  
  begin  
        line:=line1;  
        count:=count1;  
        color:=color1;  
  end;  
  {$R   *.dfm}  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  begin  
              a:=filerecord.Create();//*********  
   
  end;  
   
  end.  
  //带*号是应该改的

NO.3   作者: zsjzwj

同意楼上的。

NO.4   作者: SGP

a   :=   filerecord.Create();     //   Object   Pascal格式  
  a.Free;     //   也是Object   Pascal格式  
 

NO.5   作者: popeyepower

我来迟了,补充一下吧.你只是定义了一个类,使用的时候需要创建实例,楼上几位仁兄的方法正是如此.


 ·程序员身体状况调查    »显示摘要«
    摘要: 我是个程序员,两年,两年来总是没日没夜的干,发现身体好差,  特别是头啊!好晕! ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE