我是一个delphi初学者,在实验的时候书里的两个语句
label1.text:= inputbox('输入提示'+'请输入问候名'+'world');
和
showmessage('颜色显示失败');
出错
我不知道是我漏了什么还是书上错了
应该怎么处理?
补充一下我看的书是Delphi2005入门与提高,使用的编译环境是Delphi2005 IDE(下载的).
label1.text:= inputbox('输入提示'+'请输入问候名'+'world');
和
showmessage('颜色显示失败');
出错
我不知道是我漏了什么还是书上错了
应该怎么处理?
补充一下我看的书是Delphi2005入门与提高,使用的编译环境是Delphi2005 IDE(下载的).
解决方案 »
- 有没有第三方标尺组件?
- 散分兼推广一个小工具
- 在线等待...用delphi以最快速度写数据到MSSQLSERVER200里(实际就是把一个MSSQL服务器里的大量数据传到另一台MSSQL上,服务器上,要求自动
- INF文件
- 登录验证
- 怎么不用控件做一个图形菜单(象Windows开始菜单那样)??
- 如何使用QReport的Detail中打印指定行数的记录??即在指定的页面上填充相关数据。
- 百份想送!!!!!谁做过连接数据库的DLL
- 如何使用ADO连接oracle数据库
- 如何在delphi中画像vb的line控件那样的线?
- 高手帮忙看看这个问题如何解决
- ado连接Ora9的数据读写的循环报错!困惑中!!
这行中+号是不是改成逗号?
我也是不熟,刚查的帮助
第二个是对的,可能是你别的地方有错误。
[Error] WinForm.pas(146): E2003 Undeclared identifier: 'showmessage'
[Error] WinForm.pas(146): E2066 Missing operator or semicolon
[Error] WinForm.pas(153): E2003 Undeclared identifier: 'inputbox'
[Fatal Error] Project1.dpr(14): F2063 Could not compile used unit 'WinForm.pas'
unit WinForm;interfaceuses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data;type
TWinForm = class(System.Windows.Forms.Form)
{$REGION 'Designer Managed Code'}
strict private
/// <summary>
/// Required designer variable.
/// </summary>
Components: System.ComponentModel.Container;
Label1: System.Windows.Forms.Label;
Button1: System.Windows.Forms.Button;
Button2: System.Windows.Forms.Button;
Button3: System.Windows.Forms.Button;
Button4: System.Windows.Forms.Button;
ColorDialog1: System.Windows.Forms.ColorDialog;
FontDialog1: System.Windows.Forms.FontDialog;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure InitializeComponent;
procedure Button1_Click(sender: System.Object; e: System.EventArgs);
procedure Button2_Click(sender: System.Object; e: System.EventArgs);
procedure Button3_Click(sender: System.Object; e: System.EventArgs);
{$ENDREGION}
strict protected
/// <summary>
/// Clean up any resources being used.
/// </summary>
procedure Dispose(Disposing: Boolean); override;
private
{ Private Declarations }
public
constructor Create;
end; [assembly: RuntimeRequiredAttribute(TypeOf(TWinForm))]implementation{$AUTOBOX ON}{$REGION 'Windows Form Designer generated code'}
/// <summary>
/// Required method for Designer support -- do not modify
/// the contents of this method with the code editor.
/// </summary>
procedure TWinForm.InitializeComponent;
begin
Self.Label1 := System.Windows.Forms.Label.Create;
Self.Button1 := System.Windows.Forms.Button.Create;
Self.Button2 := System.Windows.Forms.Button.Create;
Self.Button3 := System.Windows.Forms.Button.Create;
Self.Button4 := System.Windows.Forms.Button.Create;
Self.ColorDialog1 := System.Windows.Forms.ColorDialog.Create;
Self.FontDialog1 := System.Windows.Forms.FontDialog.Create;
Self.SuspendLayout;
//
// Label1
//
Self.Label1.Location := System.Drawing.Point.Create(64, 32);
Self.Label1.Name := 'Label1';
Self.Label1.Size := System.Drawing.Size.Create(192, 104);
Self.Label1.TabIndex := 0;
Self.Label1.Text := 'hello world!';
//
// Button1
//
Self.Button1.Location := System.Drawing.Point.Create(264, 24);
Self.Button1.Name := 'Button1';
Self.Button1.TabIndex := 1;
Self.Button1.Text := 'hello';
Include(Self.Button1.Click, Self.Button1_Click);
//
// Button2
//
Self.Button2.Location := System.Drawing.Point.Create(264, 56);
Self.Button2.Name := 'Button2';
Self.Button2.TabIndex := 2;
Self.Button2.Text := 'color';
Include(Self.Button2.Click, Self.Button2_Click);
//
// Button3
//
Self.Button3.Location := System.Drawing.Point.Create(264, 88);
Self.Button3.Name := 'Button3';
Self.Button3.TabIndex := 3;
Self.Button3.Text := 'font';
Include(Self.Button3.Click, Self.Button3_Click);
//
// Button4
//
Self.Button4.Location := System.Drawing.Point.Create(264, 120);
Self.Button4.Name := 'Button4';
Self.Button4.TabIndex := 4;
Self.Button4.Text := '&quit';
//
// TWinForm
//
Self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 14);
Self.ClientSize := System.Drawing.Size.Create(368, 189);
Self.Controls.Add(Self.Button4);
Self.Controls.Add(Self.Button3);
Self.Controls.Add(Self.Button2);
Self.Controls.Add(Self.Button1);
Self.Controls.Add(Self.Label1);
Self.Name := 'TWinForm';
Self.Text := 'WinForm Demo';
Self.ResumeLayout(False);
end;
{$ENDREGION}procedure TWinForm.Dispose(Disposing: Boolean);
begin
if Disposing then
begin
if Components <> nil then
Components.Dispose();
end;
inherited Dispose(Disposing);
end;constructor TWinForm.Create;
begin
inherited Create;
//
// Required for Windows Form Designer support
//
InitializeComponent;
//
// TODO: Add any constructor code after InitializeComponent call
//
end;procedure TWinForm.Button3_Click(sender: System.Object; e: System.EventArgs);
begin
try
fontdialog1.ShowDialog;
label1.Font:=fontdialog1.Font;
except
showmessage('字体对话框显示失败。');
end;
end;procedure TWinForm.Button2_Click(sender: System.Object; e: System.EventArgs);
begin
try
colordialog1.ShowDialog;
label1.ForeColor:=colordialog1.Color;
except
showmessage('颜色对话框显示失败'); end;
end;procedure TWinForm.Button1_Click(sender: System.Object; e: System.EventArgs);
begin
label1.text:='hello'+inputbox('输入提示','请输入问候名称:','world')+'!';
end;end.
希望大家多多努力帮我找到问题所在!
Label1.Caption:= Inputbox('输入提示','请输入问候名','world');
ShowMessage('颜色显示失败');
你的错误提示是没有定义inputbox和ShowMessage函数
你看看uses里面有没有加入Dialogs, StdCtrls
showmessage('颜色显示失败');出错?? 在uses 里 引用dialogs ;
uses里面加入Dialogs, StdCtrls
label1.text不用该为label1.caption
nevergetwin(头球冲顶)说的基本上是最好的