Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 12-02-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola dmartinezn.

No está muy en claro en tu mensaje si lo que queres borrar es el contenido de la celda o el contenido del registro en el DataSet. Si es el primer caso, el amigo escafandra ya te ha dado la solución, si es el segundo podrías hacer:
Código:
/* Pasar registros del DataSet al StringGrid */
void __fastcall TForm1::CargarGridClick(TObject *Sender) {
TStringGrid *Grd = static_cast<TStringGrid*> (StringGrid1);
int f = Grd->FixedRows;
int i;

  DataSet->First();
  while(!DataSet->Eof) {
    for(i=0;i < DataSet->FieldCount; i++) {
      Grd->Objects[i][f] = DataSet->Fields->Fields[i];
      Grd->Cells[i][f] = DataSet->Fields->Fields[i]->AsString;
    };
    DataSet->Next();
    Grd->RowCount = Grd->RowCount +1;
    f++;
  }
  Grd->RowCount = f;
}

/* Eliminar el registro del DataSet, eliminar la fila del StringGrid */
void __fastcall TForm1::StringGrid1DblClick(TObject *Sender) {
TStringGrid *Grd = static_cast<TStringGrid*>(Sender);
TLocateOptions LO;
TField *F = static_cast<TField*>(Grd->Objects[Grd->Col][Grd->Row]);

  if (Grd->Row >= Grd->FixedRows) {
    DataSet->Locate(F->FieldName,Grd->Cells[Grd->Col][Grd->Row], LO);
    DataSet->Delete();
    for(int i = Grd->Row; i< (Grd->RowCount-1); i++)
      Grd->Rows[i]->Assign(Grd->Rows[i+1]);
    if(Grd->RowCount > (Grd->FixedRows+1))
      Grd->RowCount = (Grd->RowCount - 1);
    else
      Grd->Rows[Grd->FixedRows]->Clear();
  }
}
Pero en este caso me parece mas sencillo usar un TDBGrid...

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Duda con StringGrid BC++ C++ Builder 2 16-04-2009 16:49:04
Duda con StringGrid El_Perrito Varios 2 06-04-2009 20:01:51
stringgrid en celda de otro stringgrid?? noodle_ OOP 3 17-06-2008 13:36:01
Duda con el StringGrid ¿? laker OOP 3 25-04-2008 17:53:56
Pequeña duda sobre StringGrid elorza Varios 2 15-11-2007 11:34:53


La franja horaria es GMT +2. Ahora son las 13:33:52.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi