此段程序运行正常,Label1.Caption被改写
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption :=inet1.OpenURL('http://localhost/vb/1.asp');
end;
此段程序运行错误
Function connentURL(URL1:String):String
var
Inet1: TInet;
Label1: TLabel;
begin
Label1.Caption :=Inet1.OpenURL('http://localhost/vb/1.asp');
end;Inet1、Label1已在interface中声明,不过不再在自定义函数中声明的话,系统将提示“未定义”。此段程序的系统错误提示信息如下:
Debugger Exception Notification
---------------------------
Project DataTransfer.exe raised exception class EAccessViolation with message 'Access violation at address 00462114 in module '×××.exe'. Read of address 00000000'. Process stopped. Use Step or Run to continue.这是什么原因呢?
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption :=inet1.OpenURL('http://localhost/vb/1.asp');
end;
此段程序运行错误
Function connentURL(URL1:String):String
var
Inet1: TInet;
Label1: TLabel;
begin
Label1.Caption :=Inet1.OpenURL('http://localhost/vb/1.asp');
end;Inet1、Label1已在interface中声明,不过不再在自定义函数中声明的话,系统将提示“未定义”。此段程序的系统错误提示信息如下:
Debugger Exception Notification
---------------------------
Project DataTransfer.exe raised exception class EAccessViolation with message 'Access violation at address 00462114 in module '×××.exe'. Read of address 00000000'. Process stopped. Use Step or Run to continue.这是什么原因呢?
解决方案 »
- 关于Delphi XE2 在制作在iphone上的软件,有成功的么?
- delphi怎样连接Sqlite 增删改查
- 帮我看下哪里错了?
- 怎样实现拼音输入法选择汉字那样的效果。
- 在DbGrid中如何根据条件实现一字段(可以是计算字段)实时显示当前时间?
- 还是不显示窗体的关闭按扭问题,但是窗体不能最大,怎样才能最大?
- 我在原form上动态建立了一个form,并在上面建立了一些控件。请问怎么对这些控件添加过程?
- 请教:SQLDMO在DELPHI中的使用方法
- 如何在线程间进行数据传输? 如何使用CreateFileMapping?
- sqlserver7如何清空日志?日志在哪里可以看到?
- Internet Transfer Control控件在Delphi中的使用
- 请问Internet Transfer Control控件(对象名为Inet)在Delphi中怎么使用?
var
Inet1: TInet;
Label1: TLabel;
begin
Form1.Label1.Caption :=Inet1.OpenURL('http://localhost/vb/1.asp');
end;//前面加個 Form1.
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption :=inet1.OpenURL('http://localhost/vb/1.asp');
end;
也相當于
self.Label1.Caption :=inet1.OpenURL('http://localhost/vb/1.asp');
而這裹的 self 就是 TForm1 的實例了!
Form1.Label1.Caption :=Form1.Inet1.OpenURL('http://localhost/vb/1.asp');就OK了
谢谢你,大版主!
还想问一下,如果要把自定义函数变成窗体的方法,应该怎么做呀?
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure ss;
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.ss;
begin
end;
放到你的那个类的private或者public
就不会出问题了