Delphi Tutorial Listbox manipulate items
In this video you can learn how to manipulate with Listbox items in Delphi.
You can learn how to add one, add multiple items, delete one or all items , so as save items to and load from text file.
Here is also code used in this video :
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Button3: TButton;
Edit2: TEdit;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ListBox1.Items.Add('Item - '+IntToStr(ListBox1.Items.Count));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ListBox1.Items.Add(Edit1.Text);
end;
procedure TForm1.Button3Click(Sender: TObject);
var
i:Integer;
begin
ListBox1.Items.Clear; // clear all items in listbox first
for I := 1 to StrToInt(Edit2.Text) do
begin
ListBox1.Items.Add('Item - '+IntToStr(i));
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
ListBox1.Items.Clear;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
if SaveDialog1.Execute then
SaveDialog1.InitialDir:='C:\Temp\';
ListBox1.Items.SaveToFile(SaveDialog1.FileName);
ListBox1.Items.Clear;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
ListBox1.Items.Clear;
if OpenDialog1.Execute then
OpenDialog1.InitialDir:='C:\Temp\';
ListBox1.Items.LoadFromFile(OpenDialog1.FileName);
end;
end.
Music in video by :
bensound-theelevatorbossanova
www.bensound.com
Tutorials by KobyX
Login
Enter your username and password to enter your Blogger Dasboard
Featured Post
Power resistor DIY
Power resistor DIY This is one simple way to create power resistor at home. I needed 0,33 ohm resistor with some larger wattage so I de...
Recent Articles
-
Delphi tutorial – connect MySQL with ZEOS library After you manage to create this application, you will actually have small MySQ...
-
For this app to create you will need "sqlite3.dll" file which you can download from : https://sqlite.org/ or you can download ...
-
Delphi Tutorial work with INI files In this lesson you can learn how to work with INI files in Delphi. You can learn how to...
-
Delphi Tutorial Listview In this tutorial you can learn how to work with Listview in Delphi. You can learn how to create,edit and delete ...
-
Delphi tutorial MS Access database with KADao This is Delphi Tutorial about creating and manipulating MS Access database with KADAo com...
-
In this example I will show you how to use external fonts in your application, without installing font. Following video shows details about...
-
Power resistor DIY This is one simple way to create power resistor at home. I needed 0,33 ohm resistor with some larger wattage so I de...
-
In this video you can learn how to work with Timer in Delphi. You can learn how to manipulate with components using timer. example applic...
-
Delphi Tutorial Listbox manipulate items In this video you can learn how to manipulate with Listbox items in Delphi. You can learn how ...
-
Delphi tutorial Client server application This is Delphi Tutorial about client-server application, and as usual you can find here sourc...
Tuesday, January 26, 2016
Delphi Tutorial Listbox manipulate items
Comments
Search This Blog
Popular Posts
-
Delphi tutorial – connect MySQL with ZEOS library After you manage to create this application, you will actually have small MySQ...
-
For this app to create you will need "sqlite3.dll" file which you can download from : https://sqlite.org/ or you can download ...
-
Delphi Tutorial work with INI files In this lesson you can learn how to work with INI files in Delphi. You can learn how to...
-
Delphi Tutorial Listview In this tutorial you can learn how to work with Listview in Delphi. You can learn how to create,edit and delete ...
-
Delphi tutorial MS Access database with KADao This is Delphi Tutorial about creating and manipulating MS Access database with KADAo com...
-
In this example I will show you how to use external fonts in your application, without installing font. Following video shows details about...
-
Power resistor DIY This is one simple way to create power resistor at home. I needed 0,33 ohm resistor with some larger wattage so I de...
-
In this video you can learn how to work with Timer in Delphi. You can learn how to manipulate with components using timer. example applic...
-
Delphi Tutorial Listbox manipulate items In this video you can learn how to manipulate with Listbox items in Delphi. You can learn how ...
-
Delphi tutorial Client server application This is Delphi Tutorial about client-server application, and as usual you can find here sourc...
0 comments: