Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selected Item in ListBox 1

Status
Not open for further replies.

lespaul

Programmer
Feb 4, 2002
7,083
US
If I have a list box that shows:

525: CV12345
526: DW12345
527: CR12345

and I want the user to double click on one of the items, how can I extract the first three characters (525 or 526)of the line that was double clicked?

Thanks!

Leslie
 
Something like this:
Code:
uses StrUtils;

procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
  ShowMessage( LeftStr( ListBox1.Items[ListBox1.ItemIndex], 3 ) );
end;

Andrew
Hampshire, UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top