Solved

Editing Listbox on runtime

Posted on 2004-03-26
4
268 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month5 days, 20 hours left to enroll

627 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