调试时为什么总不运行!!!!!!!!!谢谢大家了!!!!!!1 (100分)

  • 主题发起人 主题发起人 dreameast
  • 开始时间 开始时间
D

dreameast

Unregistered / Unconfirmed
GUEST, unregistred user!
我是一个delphi初学者,最近把书上的例子上级练习,一切照书上打下来然后运行却总不显示
窗体界面,而是回到没按运行键的状态,而且我把网上的例子拿来运行时有的也是如此,不知
何故!请那位高人指点一下!!!!!

按的是f8.程序是书上的例子,很普通。

 
你这个问题让人怎么回答?
太难了~~~
代码呢
 
代码如下:用webbrowser组件实现上网的功能。控件有一个toolbar,一个webbrowser,一个statusbr.
在toolbar中,有一个label,一个edit,一个button,六个speedbutton.
unit webbrowser;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, OleCtrls, SHDocVw, StdCtrls, ToolWin, Buttons;

type
TForm1 = class(TForm)
SpeedButton1: TSpeedButton;
ToolBar1: TToolBar;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
WebBrowser1: TWebBrowser;
StatusBar1: TStatusBar;
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure webbrowser1downloadbegin(Sender: TObject);
procedure webbrowser1downloadcomplete(Sender: TObject);
procedure edit1keydown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure formresize(Sender: TObject);
procedure Formshow(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
try
webbrowser1.GoBack;
except
showmessage('已经达到了首条历史记录');
exit;
end;

procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
try
webbrowser1.goforward;
except
showmessage('已经达到了最后一条记录');
exit;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
webbrpwser1.nacigate(edit1.Text);
end;

procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
form2.show;
end;

procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
webbrowser1.gohome;
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
webbrowser1.stop;
statusbar1.simpletext:='试图链接地址:'+webbrowser1.locationurl+'是被用户中断. ';

end;

procedure TForm1.webbrowser1downloadbegin(Sender: TObject);
begin
edit1.text:=webbrowser1.locationurl;
seedbutton3.enabled:=true;
onurl;satausbar1.simpletext:='正在连接地址:'+webbrowser1.locati

end;

procedure TForm1.edit1keydown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=13 then
webbrowser1.nacigate(edit1.text);

end;

procedure TForm1.formresize(Sender: TObject);
begin
edit.width:=form1.width*220div500;

end;

procedure TForm1.Formshow(Sender: TObject);
begin
webbrowser1.navigate('166.111.9.2);
end;
procedure TForm1.webbrowser1downloadcomplete(Sender: TObject);
begin

satausbar1.simpletext:='正在连接地址:'+webbrowser1.locationurl;
speedbuton3.enabled:=false;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
webbrowser1.stop;
satausbar1.simpletext:='正在连接地址:'+webbrowser1.locationurl +'时被用户中断';
end;

end.

 
[red]看仔细哦,[/red]
unit webbrowser;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, OleCtrls, SHDocVw, StdCtrls, ToolWin, Buttons;

type
TForm1 = class(TForm)
SpeedButton1: TSpeedButton;
ToolBar1: TToolBar;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
WebBrowser1: TWebBrowser;
StatusBar1: TStatusBar;
procedure SpeedButton7Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure webbrowser1downloadbegin(Sender: TObject);
procedure webbrowser1downloadcomplete(Sender: TObject);
procedure edit1keydown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure formresize(Sender: TObject);
procedure Formshow(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
try
webbrowser1.GoBack;
except
showmessage('已经达到了首条历史记录');
exit;
end;
// <————此处缺少 end;
procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
try
webbrowser1.goforward;
except
showmessage('已经达到了最后一条记录');
exit;
end;
// <-----------此处缺少 end;
procedure TForm1.Button1Click(Sender: TObject);
begin
webbrpwser1.nacigate(edit1.Text); //此行笔误
// ^^^^^^^^^^^^^^^^^这是什么?
end;

procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
form2.show;
end;

procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
webbrowser1.gohome;
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
webbrowser1.stop;
statusbar1.simpletext:='试图链接地址:'+webbrowser1.locationurl+'是被用户中断. ';

end;

procedure TForm1.webbrowser1downloadbegin(Sender: TObject);
begin
edit1.text:=webbrowser1.locationurl;
seedbutton3.enabled:=true;
//onurl;satausbar1.simpletext:='正在连接地址:'+webbrowser1.locati
//^^^^^^^^^^^^^^^^ ^^^^^^
//此处应属笔误
statusbar1.simpletext:='正在连接地址:'+webbrowser1.LocationURL;

end;

procedure TForm1.edit1keydown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=13 then
webbrowser1.nacigate(edit1.text);//此行笔误????
// ^^^^^^^^
end;

procedure TForm1.formresize(Sender: TObject);
begin
edit.width:=form1.width*220div500; //此行笔误?????
// ^^^^^此处笔误 ^^^ 缺空格
end;

procedure TForm1.Formshow(Sender: TObject);
begin
webbrowser1.navigate('166.111.9.2);
end;
procedure TForm1.webbrowser1downloadcomplete(Sender: TObject);
begin

satausbar1.simpletext:='正在连接地址:'+webbrowser1.locationurl;
//^^^^^^^^^此行也为笔误
speedbuton3.enabled:=false;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
webbrowser1.stop;
satausbar1.simpletext:='正在连接地址:'+webbrowser1.locationurl +'时被用户中断';
//^^^^^^^^^^此行笔误
end;

end.

 
>按的是f8
按F9才是运行啊。
 
哈哈哈,dreameast你真逗。[:D]
 
要学会使用语法检查功能,只有语法通过了,才有可能运行啊
 
落雨樵真好人呀~~看得好仔细。
 
F8是 Step Over功能啊!
F9才是 Run 呢!你再按按F9試試吧
代碼我沒看你的,不過只要一有問題!當你按下F9后系統會返回給你的!
當然你也可以不按F9而真接選擇Run 下的 Run功能也可!
 
你不会没有工程文件吧!
 
后退
顶部