# Delphi(&Pascal) problem with TStrings.delete();?



## jamiemac2005 (Jul 5, 2007)

Hey,
I'm writing a context menu editor, and i have a problem with using the comboBox.Items.Delete(index); function:


```
//for each of the items see if it's an extension or '*'
  for forCount := 1 to cmbExtensions.Items.Count-1
  do
  begin
    //if the begginning of the name is not '.' then delete
    firstChar := cmbExtensions.Items[forCount];
    firstChar := midStr(firstChar, 1, 1);
    //showmessage(firstChar);
    if (firstChar <> '.')
    then
    begin
     //showmessage('not right');
     //break;
     //showmessage(firstChar);
     //showmessage(cmbExtensions.Items[forcount]);
     //showmessage(intToStr(forcount));
    cmbExtensions.Items.Delete(forcount);
    //showmessage(cmbExtensions.Items[forcount]);

    end;
  end;//for each of the items
```
Basically i can get the messages to show before/after the delete function, so the item is not deleting... I've researched the subject and the usage is fine...

cmbExtensions.items is every registry key in HKEY_CLASSES_ROOT, and what i'm trying to do is filter them down into only the .extensions and * but all my attemps have failed...

I understand that this being delphi 7 it is quite outdated but if anyone has knowledge of it and can help with the problem i'd be very greatful...

Cheers,
Jamey


----------

