Hi Bevan Yes you are quite correct. I got that about 2 minutes after going away and having a red bull.
ITS FRIDAY!!! YAY Tracey -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, 20 August 2004 10:56 a.m. To: [EMAIL PROTECTED] Subject: [DUG] Re: DUG listbox items values Hi Tracey, It's been a while since I did any Delphi, but can't you just use Integer(lbOSMOS.Items.Objects[i]) ? Regards, Bevan -------Original Message--------- From:"tracey" <[EMAIL PROTECTED]> To:"NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]> Cc: Subject:[DUG] listbox items values Date:Fri, 20 Aug 2004 10:41:17 +1200 Hello all I am working on VCL development for a change at the moment. I am trying to use TListBox and getting a little lost. I fill the listbox with items like so: //Run a Query, return some records First; while not eof do begin lbMapTo.Items.AddObject(FieldByName('workzonename').AsString, TObject(FieldByName('workzoneid').AsInteger)); Next; end; procedure TfrmWorkZones.btnSelectOSMOSClick(Sender: TObject); var i: integer; begin //loop through lbOSMOS items to find the selected item. for i := 0 to lbOSMOS.Items.Count - 1 do begin if lbOSMOS.Selected[i] then lbSelectedOsmos.Items.AddObject(lbOSMOS.Items.Strings[i], lbOSMOS.Items.Objects[i]) end; lbOSMOS.DeleteSelected; end; My problem is, when I want to save back to the database from the "selected items" listbox, how do I cast the item's "object" value to integer? I must say I must be getting too used to Visual Studio, I found myself quite disappointed that I couldn't just bind workzonename to listbox.displayfield and workzoneid to listbox.valuefield Perhaps I am going totally the wrong way? Any advice before I waste too much time on this? Cheers Tracey _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
