代码如下。
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, jpeg, ExtCtrls;type
  TForm1 = class(TForm)
    Image1: TImage;
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Image2: TImage;
    Label3: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    RadioButton3: TRadioButton;
    Button1: TButton;
    Label4: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Label3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementationuses Unit2;{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
form1.Color:=rgb(8,190,255); // 设置FORM1的颜色
{注意的几个问题: 1.Delphi程序中赋值符号为:=
                  2.颜色自定义的方法RGB(R,G,B)
                  3.Delphi里,每行语句必须以;号结尾}
end;procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('测试程序 ^_^');  // 探出对话框显示内容
end;procedure TForm1.Label3Click(Sender: TObject);
begin
form2.show;  //显示form2
end;end.-----------------------------------------------------------------------
unit Unit2;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;type
  TForm2 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Button1: TButton;
    Button2: TButton;
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form2: TForm2;implementation{$R *.dfm}end.

解决方案 »

  1.   

    你想调用什么
    Unit2 中的过程 函数??
      

  2.   

    想调用什么
    Unit2 中的过程 函数??只要把 过程 函数 声明为 public 
    就可以了
      

  3.   

    我是初学者。就是。按F9运行的时候出现错误。。运行不了。。好麻烦哦。。懂的加我QQ好哇。帮下忙。。
      

  4.   

    在 unit2中 的 函数写在public中,uses unit2;
      

  5.   

    楼上正解
    不能写在private中
      

  6.   

    过程 函数 声明为 public 
    然后 uses unit2;
      

  7.   

    uses unit2;
    然后直接调用就行了
      

  8.   

    楼上正解
    不能写在private中
      

  9.   

    我想你报的错误可能是地址错.Delphi和java不同是一个非完全OO概念上的语言.在一个单元文件里(假设只有一个类的定义,就说普通的窗体类好了),不同地方定义的函数和过程作用都不一样.窗体类的所有事件过程都必须在窗体内所有组件变量(及属性)的定义之后并且在published内定义,自动生成的代码里省略了默认的published. private里定义的为私有的变量及函数,public里定义的为公有变量及函数.protect里定义的为保护变量和函数.published定义变量为发布,其所有子类都能继承,该类的实例都能调用.private里定义变量只能在该类内部使用,子类不能继承,类的外部也不能访问.public内的定义访问权限和published差不多,但组件编程里只有写在published里的属性才能在对象监视器里看到.protect里的定义我不是很清楚,好象是只能在其直接子类里调用.另外还有声明在类定义外面的,这种函数在引用单元后都可以直接调用.以上是我的理解,有错的地方,请高手指教.
    你的程序如果是报地址错的话可能是form2没有创建,也就是说form2没有实例化.
      

  10.   

    form1.Color:=rgb(8,190,255); // 设置FORM1的颜色
    {注意的几个问题: 1.Delphi程序中赋值符号为:=
                      2.颜色自定义的方法RGB(R,G,B)
                      3.Delphi里,每行语句必须以;号结尾}
    你的form1还没有建立好,你放到ONSHOW里就可以了应该
      

  11.   

    没看懂楼主的意思.
    如果颜色自定义的方法RGB(R,G,B)在Unit2中,那当然报错啦
      

  12.   

    form2没有创建
    一群人分析那么长时间还什么private public,我就汗
      

  13.   

    报什么错啊,晕死!
    Tform2.create(self).show;  //显示form2
      

  14.   

    form1.Color:=rgb(8,190,255); // 设置FORM1的颜色
    {注意的几个问题: 1.Delphi程序中赋值符号为:=
                      2.颜色自定义的方法RGB(R,G,B)
                      3.Delphi里,每行语句必须以;号结尾}
    放在onshow事件里面
      

  15.   

    楼主牛x了,在unit1中 直接就show unit2的窗体,都不带create的。
      

  16.   

    你这是直接COPY网上的代码。 自己写下就就知道 问题了