Solved

Editing Listbox on runtime

Posted on 2004-03-26
4
263 Views
Last Modified: 2010-04-05
Hey,

Can someone tell me how I can edit my listbox on runtime to when I select a item in the listbox and then click and button it will add "Locked" after the string in the listbox.

Cheers,

Computer Programer
0
Comment
Question by:computerprogramer
  • 2
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 40 total points
ID: 10685217
procedure TForm1.Button2Click(Sender: TObject);
begin
ListBox2.Items[ListBox2.ItemIndex] := ListBox2.Items[ListBox2.ItemIndex]+' Locked';
end;
0
 
LVL 17

Expert Comment

by:mokule
ID: 10685234
or better with check

procedure TForm1.Button2Click(Sender: TObject);
begin
if (ListBox2.Items.Count > 0) and (ListBox2.ItemIndex >= 0) then
  ListBox2.Items[ListBox2.ItemIndex] := ListBox2.Items[ListBox2.ItemIndex]+' Locked';
end;
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 10685235
Is this what you are looking for?
(Add text 'Locked' to current item of list box when a button is clicked)

procedure TForm1.Button1Click(Sender: TObject);
begin
  If ListBox1.ItemIndex >= 0 then
  Begin
    ListBox1.Items[ListBox1.ItemIndex] := ListBox1.Items[ListBox1.ItemIndex] + 'Locked';
  End;
end;

...Shu
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 10685282
3 minutes: too late.
:-)
...Shu
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now