Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   C++ Builder (https://www.clubdelphi.com/foros/forumdisplay.php?f=13)
-   -   tedit a Stringgrid (https://www.clubdelphi.com/foros/showthread.php?t=84958)

ralmic 05-01-2014 01:30:36

tedit a Stringgrid
 
hola forista..una pregunta. esty tratando de ingresar texto desde un objeto tedit a un stringgrid alguien me puede ayudar con este tema, trabajo con c++buider xe3

ecfisa 05-01-2014 08:27:02

Hola ralmic.

La primera respuesta que se me ocurre sería:
Código:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TStringGrid *sg = static_cast<TStringGrid*>(StringGrid1);
  sg->Cells[sg->Col][sg->Row] = Edit1->Text;
}

Pero tu pregunta admite muchas interpretaciones, ¿ Podrías especificar de forma mas detallada lo que intentas hacer ?

Saludos :)

ralmic 06-01-2014 02:34:17

tedit stringgrid
 
tengo 3 tedit y quiero a agregarlos a 3 columnas de un stringgrid y asi sucesivamente cuando le de click al boton pase a la siguiente fila y los agregue

ralmic 06-01-2014 02:41:11

tedit stringgrid
 
especiicamente agregar el texto del tedit al stringrid

ecfisa 06-01-2014 04:39:18

Cita:

Empezado por ralmic (Mensaje 471351)
tengo 3 tedit y quiero a agregarlos a 3 columnas de un stringgrid y asi sucesivamente cuando le de click al boton pase a la siguiente fila y los agregue

Hola ralmic.

Código:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  TStringGrid *sg = static_cast<TStringGrid*>(StringGrid1);
  static int CurrentRow = sg->FixedRows;

  if (CurrentRow < sg->RowCount) {
    sg->Cells[sg->FixedCols][CurrentRow]  = Edit1->Text;
    sg->Cells[sg->FixedCols+1][CurrentRow] = Edit2->Text;
    sg->Cells[sg->FixedCols+2][CurrentRow] = Edit3->Text;
    CurrentRow++;
  }
}

Saludos :)


La franja horaria es GMT +2. Ahora son las 12:08:20.

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