procedure TForm1.Button1Click(Sender: TObject);
begin
Table1.Open; 
if Table1.Active then
Begin
   Button1.Caption:='连接成功';
   //...
end
else
Begin
   Button1.Caption:='连接失败';
   //...end; 
end;   

解决方案 »

  1.   

    table1.active := not table1.active;
    if table1.active then
      button1.cation := 'open'
    else
      button1.cation := 'close'
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    if button1.caption:='连接' then
    begin
        Table1.Open;
        button1.caption:='断开';
        //....
    end
    else
    begin
        Table1.close;
        button1.caption:='连接';
       //...end;
    end;
    这个怎么样??
      

  3.   

    Table1.Active:=not Table1.Active;
    if Table1.Active then
    button1.caption:='连接'
    else
        button1.caption:='断开';
      
      

  4.   

    其实应该是
    Table1.Active:=not Table1.Active;
    if Table1.Active then
    button1.caption:='断开'
    else
        button1.caption:='连接';
      
      

  5.   

    const 
      stattext : array [0..`1] of string = ('连接','断开');table1.active := not table1.active;
    button1.caption := stattext[integer(table1.active)]; 
      

  6.   

    table1.active := not table1.active;
    button1.cation := '断开';
    if table1.active then  button1.cation := '连接';
       
      

  7.   

    楼上各位,短线怎么办?哈哈,设置caption最好是用Timer
    ....ontimer(...)
    begin
         if table1.active=true then
             button1.caption:='断开'
         else
             button1.caption:='连接';end;在 button的onclick 加上:
    begin
        table1.active:=not table1.active;
    end;就行了
      

  8.   


    楼上各位,短线怎么办? 哈哈,设置caption最好是用Timer
    ....ontimer(...)
    begin
        if table1.active=true then
            button1.caption:='断开'
        else
            button1.caption:='连接';end;在 button的onclick 加上:
    begin
        table1.active:=not table1.active;
    end;就行了