adding to list boxes
Posted on 2011-05-06
Hi, i have some code but i cant get it to work the way i want. The code is probably messed up now..
I want when i select a user from the menu it adds the field to speciallist1 which is a listbox. This is fine, when i close program and reopen it saves and opens the listbox fine.
When i try and add the user again, it gives an error and this is perfect. However.. i want to add the user to both listboxes..
speciallist1 and speciallist2
if i try and add the user again, if he is located in listbox2 already (speciallist2 ) dont add him to any boxes.
dont bother checking speciallist1.. only the 2nd listbox.
my messed code:
DBadd1 = edit.text
speciallist1 = listbox
speciallist2 = listbox
mylist11 = save list for 1st listbox
mylist12 = save list for 2nd listbox
Iam working on form 13 and using listboxes on form35.
procedure TForm13.Addcustomertospeciallist1Click(Sender: TObject);
strm : TFileStream;
form35.speciallist2.Items.IndexOf(DBadd1.Text) = -1
strm := TFileStream.Create('MyList12.DAT', fmCreate);
form35.speciallist1.Items.IndexOf(DBadd1.Text) = -1
strm := TFileStream.Create('MyList11.DAT', fmCreate);
windows.MessageBox(handle, 'User already special member specialist1', 'SPECIAL LIST - NOT ADDED!!',
MB_SYSTEMMODAL or MB_SETFOREGROUND or MB_TOPMOST or MB_ICONhand)