Mensaje    Asunto: Ayudas en TEdit Responder citando

Yo uso este código para facilitar ayuda en un campo TEdit; la típica ayuda que va facilitando un valor según vamos tecleando. se pone en el evento OnKeyUp del TEdit y la propiedad CharCase está como ecUpperCase:
Código:
int nPos = Edit1->SelStart;

if (nPos > 0 && ((Key > 64 && Key < 91) || Key == 165))
{
     AnsiString cAux = Edit1->Text.SubString(1, Edit1->SelStart + 1);
     Query1->Close();
     Query1->SQL->Text = "SELECT * FROM Tabla WHERE Nombre LIKE :Nombre ORDER BY Nombre";
     Query1->ParamByName("Nombre")->AsString = Edit1->Text.SubString(1, Edit1->SelStart + 1) + "%";
     Query1->Open();
     if (!Query1->IsEmpty())
     {
          Edit1->Text = Query1->FieldByName("Nombre")->AsString;
          Edit1->SelStart = nPos;
          Edit1->SelLength = Edit1->Text.Length();
     }
}

Si el campo es TLMDEdit el código es un poco distinto:
Código:
int nPos = Edit1->CurrentChar;

if (nPos > 0 && ((Key > 64 && Key < 91) || Key == 165))
{
     AnsiString cAux = Edit1->Text.SubString(1, nPos + 1);
     Query->Close();
     Query->SQL->Text = "SELECT * FROM Tabla WHERE Nombre LIKE :Nombre ORDER BY Nombre";
     Query->ParamByName("Nombre")->AsString = Edit1->Text.SubString(1, nPos + 1) + "%";
     Query->Open();
     if (!Query->IsEmpty())
     {
          Edit1->Text = Query->FieldByName("Nombre")->AsString;
          Edit1->CurrentChar = nPos;
          Edit1->SelLength = Edit1->Text.Length() - nPos + 1;
     }
}

Espero que os sirva.
_________________
Un saludo

Necesitamos tu ayuda: Envía AI al 27595 (Coste 1,20 euros + IVA)