Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Для новичков > txt or db or ini file


Автор: muratboy31 14.1.2010, 10:29
ok this codes work perfect but i want to know if saving links to a txt file would cause a problem when there r lots of links in it !!!

Код

procedure TForm1.FormCreate(Sender: TObject);
begin
if FileExists('urls.txt') then
combobox1.Items.LoadFromFile('urls.txt');
end;


Код

procedure TForm1.ComboBox1KeyPress(Sender: TObject; var Key: Char);
var
URL:string;
Num:integer;
begin
    if key = #13 then
    begin
    URL:=combobox1.Text;
       if URL<>'' then
       begin
       DesignTimeWB.Go(URL);
        Num:=0;
          while Num<combobox1.Items.Count do
          begin
             if combobox1.Text = combobox1.Items[Num] then
             begin
             abort;
             end else
             begin
             inc(Num);
             end;
          end;
       combobox1.Items.Add(URL);
       combobox1.Items.SaveToFile(ExtractFilePath(Application.ExeName)+'urls.txt');
     end;
   end;
end;


how can i do it with sql db file ?

Автор: RomanEEP 14.1.2010, 15:45
I think you don't need sql database unless the number of urls exceeds 100000 or so.
But it isn't a good idea to save urls to file each time user push a button. I recommend to do it once in OnDestroy event.

Автор: muratboy31 14.1.2010, 16:24
thanks alot RomanEEP  smile 
i really love this forum thanks everyone for helps

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)