Hi Gentlemen,
Thank you for your responses;
I'm still a bigginer in Symbian C++. and I'm trying to delete a specific sms in the sentBox msg folder. am not too sure of the syntax and thefore not too sure where I might be going wrong 
Here is what I've done so far, but I still get the same error:
Code:
void CSmsHandler::DeleteMessages()
{
HBufC* SMSContent = HBufC::NewLC(400);
//HBufC* SMSContent8 = HBufC::NewLC(400);
CMsvStore* sentboxStore;
TMsvSelectionOrdering sort;
sort.SetShowInvisibleEntries(ETrue); // we want to handle also the invisible entries
CMsvEntry* sentboxContext=CMsvEntry::NewL(*iSession,KMsvSentEntryId,sort);
CleanupStack::PushL(sentboxContext);
CMsvEntrySelection* entries = sentboxContext->ChildrenL();
CleanupStack::PushL( entries );
TInt msgCount= entries->Count();
TInt i;
for (i=0; i <= msgCount; i++)
{
TMsvId entryID = entries->At(i);
iSmsMtm->SwitchCurrentEntryL(entryID);
CMsvEntry* entry= iSession->GetEntryL((*entries)[i]);
CleanupStack::PushL(entry);
/* Skip loop if fail in obtains the message store */
TRAPD(r, sentboxStore = entry->ReadStoreL());
if(KErrNone != r)
{
CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
note->ExecuteLD(_L("Error Accessing inbox"));
CleanupStack::PopAndDestroy(entry);
continue;
}
if (sentboxStore->HasBodyTextL())
{
CRichText& richText= iSmsMtm->Body();
sentboxStore->RestoreBodyTextL(richText);
const TInt length = richText.DocumentLength();
SMSContent->Des().Copy(richText.Read(0,3));
_LIT(KText1, "???");
TBufC16<3> buf11(KText1);
HBufC* buf1 = buf11.AllocLC();
TInt res = buf1->Compare(SMSContent->Des());
CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
note->ExecuteLD(_L("Eveluating message: "));
CEikonEnv::Static()->AlertWin(*SMSContent); //Alert window..
if (res == 0)
{
CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
note->ExecuteLD(_L("DeletingMessage"));
//CleanupStack::PopAndDestroy(2,entry);
// CleanupStack::PopAndDestroy(4,SMSContent);
//CleanupStack::PopAndDestroy(SMSContent);
//CleanupStack::PopAndDestroy(buf1);
//CleanupStack::PopAndDestroy(res);
//CleanupStack::PopAndDestroy(sentboxStore);
//delete sentboxStore;
entry->DeleteL(entryID);
CleanupStack::PopAndDestroy(sentboxStore);
CleanupStack::PopAndDestroy(entry);
}
richText.Reset();
}
else
{
// no text in SMS
CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
note->ExecuteLD(_L("NO Text"));
}
}
CleanupStack::PopAndDestroy(entries);
CleanupStack::PopAndDestroy(sentboxContext);
}