Arsip: STringGrid kr edit box

 
user image
more 13 years ago

bogem

mas2 and mbak2 sekalian, mau nanya nich. boleh khan ..... :D aq ada permasalahan nich aq tu pengen mindahan data yang ada pada StringGrid ke Edit BOx contohnya gini stringgrid cell [1,1] = 1 stringgrid cell [2,1] = 5 sehingga hasilnya pada edit box jadi 15 tolong ya mas2 and mbak2 skalian trim's
user image
more 13 years ago

MrMixer

Maksudnya biar di edit box terisi nilai sesuai apa yang ada di String Grid ya.. Kayak begini bukan..??
var
  I, J : Integer;
  MyText :String;
begin
  MyText := '';
  with StringGrid1 do
    for I := 0 to ColCount - 1 do
      for J:= 0 to RowCount - 1 do
        begin
          MyText := Cells[I,J];
        end;
   Edit1.Text := MyText
end;
user image
more 13 years ago

kaka-delphi

Maksudnya gimana yach .... kalau cuman mindahin doang khan cukup :

with StringGrid1 do
begin
  Cells[1,1]:= '1'; 
  Cells[2,1]:= '5';
  Edit1.Text:= Cells[1,1] + Cells[2,1];
end;
xixixixixixiiiiii .....
user image
more 13 years ago

bogem

Mr Mixer, skripnya blm berhasil yang masuk cuman data pada stringgrid cell pertama, yang kedua and saterusnya g mau masuk piye ki..... :(
user image
more 13 years ago

MrMixer

Sorry sobb... Itu salah cetak... :D Ralat dikit, mustinya skripnya tertulis begini :
begin          
  MyText := MyText + Cells[I,J];        
end;
Kalau kayak gini, semua data yang ada di String Grid pasti masuk ke Edit Box..
user image
more 13 years ago

bogem

mas, kalo pake tambahan skrip "MyText := MyText + Cells[I,J]" yang masuk cuman 2 data, data yang selanjutnya g mau masuk
user image
more 13 years ago

MrMixer

Koq.. aku masuk semua ya ..! Ini Contoh Programnya.. Masak Aku bohong..!!
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Grids;
type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
var  I, J : Integer;
begin
   with StringGrid1 do
      for I := 0 to ColCount - 1 do
          for J:= 0 to RowCount - 1 do
             begin
               Cells[I,J] := FormatFloat('#',i+j);
             end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var  I, J : Integer;
     MyText :String;
begin
   MyText := '';
   with StringGrid1 do
      for I := 0 to ColCount - 1 do
          for J:= 0 to RowCount - 1 do
             begin
               MyText := MyText + Cells[I,J];
             end;
   Edit1.Text := MyText
end;

end.
user image
more 13 years ago

bogem

makasih mas sori aku salah nyekrip ulangnya
user image
more 13 years ago

MrMixer

Sama-sama.. :D
more ...
  • Pages:
  • 1
Share to

Random Topic

Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com