1、我刚开始学习Delphi6,以前我对计算机也只是了解一点,需要先学习c语言吗?(我在学习的过程中发现好多语言比如:showmodal、showmessage等不知从那里学到)
2、Label组件的caption属性在运行过程中的赋值怎么是错误的呐?以下错在哪里?*
  一个form窗体中有两个组件:label1、button1,
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;
type
  TForm1 = class(TForm)
    Label: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
 i,iSum  :  integer;
 XianShi :  string;
begin
  iSum:=0;
  for i:=1 to 100 do
  inc(iSum,i);
  XianShi:= ' intToStr('iSum') ' ;
label1.caption := 'xianSHi';
//为什么点击button1后labele1显示的是“xianShi”,而不是“5050”?
end;
end. 

解决方案 »

  1.   

    1,都是VCL封装的函数。C还是学一点好,学点C++了解OOP思想。
    2,label1.caption :=  intToStr(iSum)  ;
      

  2.   

    XianShi:= ' intToStr(iSum) ' ;
    'iSum'是字符串,而iSum才是变量
      

  3.   

    xianshi加了‘后,就成了字符串,不再是变量了。
      

  4.   

    http://www.kaer.cn/default.aspx
    有很多基础事例程序,可以下来参考。
      

  5.   

    unit Unit1;
    interface
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCtrls;
    type
      TForm1 = class(TForm)
        Label: TLabel;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    var
      Form1: TForm1;
    implementation
    {$R *.dfm}
    procedure TForm1.Button1Click(Sender: TObject);
    var
     i,iSum  :  integer;
     XianShi :  string;
    begin
      iSum:=0;
      for i:=1 to 100 do
      inc(iSum,i);
      XianShi:= ' intToStr(iSum) ' ;    //=======
    label1.caption := xianSHi;          //=======
    //为什么点击button1后labele1显示的是“xianShi”,而不是“5050”?
    end;
    end.
      

  6.   

    label1.caption := xianSHi;XianShi:= intToStr('iSum') ;你怎么这么爱加引号?
      

  7.   

    foxyy8888(为升星眼也花了) 
    老大,我理解你很想升星星的心情,可是也不用这样跟我抢这区区10分吧……
      

  8.   

    IntToStr example(DELPHI自带的帮助文件中例子)procedure TForm1.Button1Click(Sender: TObject);begin
      try
        Label1.Caption := IntToStr(StrToInt(Edit1.Text) * StrToInt(Edit2.Text));
      except
        ShowMessage('You must specify integer values. Please try again.');
      end;
    end;
      

  9.   

    XianShi:=  intToStr('iSum') ;
    label1.caption := xianSHi;
      

  10.   

    看看pascal基础教程也许对你有帮助