Delphi Indonesia - Mobile Edition

nama: pass:

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
aliexdsgOffline
Location:
Post subject: Tanya cara input dari dbgrid ke stringgrid atau yang lainnya  PostPosted: 02/Sep/2010 10:48
onConfident


Joined: 03-Aug-2009
Posts: 23

Status: Offline
Para Delphier...
Saya ingin bertanya...
untuk mengambil data dari salah satu kolom dbGrid bagaimana ya?
karena saya kebingungan untuk menentukan letak data secara spesifik,, tidak seperti stringgrid bisa langsung ke kolom dan baris,
misalkan saya punya tabel dbgrid
==============================
No | Data | Keterangan
==============================
1 | .. |
2 | .. |
3 | x |
4 | .. |
5 | .. |
==============================
saya ingin mengambil nilai 'x' pada kolom 'data' baris ke '3' untuk dimasukkan ke stringgrid, tanpa harus mengklik pada dbgrid
bagaimana ya caranya?
 
 View user's profile Send private message  
Reply with quote Back to top
budi_slemanOffline
Location:
Post subject: Re: Tanya cara input dari dbgrid ke stringgrid atau yang lai  PostPosted: 05/Sep/2010 09:00
onConfident


Joined: 24-Dec-2009
Posts: 22

Status: Offline
      aliexdsg wrote:
Para Delphier...
Saya ingin bertanya...
untuk mengambil data dari salah satu kolom dbGrid bagaimana ya?
karena saya kebingungan untuk menentukan letak data secara spesifik,, tidak seperti stringgrid bisa langsung ke kolom dan baris,
misalkan saya punya tabel dbgrid
==============================
No | Data | Keterangan
==============================
1 | .. |
2 | .. |
3 | x |
4 | .. |
5 | .. |
==============================
saya ingin mengambil nilai 'x' pada kolom 'data' baris ke '3' untuk dimasukkan ke stringgrid, tanpa harus mengklik pada dbgrid
bagaimana ya caranya?


pertama tetapkan prosedurnya mau onshow atau yang lain

procedure ........

begin

stringgrid.Cells[2,2]:=dbgrid.cells[1,3];
end;

maaf kalau salah, soalnya dah lama nggak make Delphi
 
 View user's profile Send private message  
Reply with quote Back to top
heriy4nt0Offline
Location:
Post subject: Re: Tanya cara input dari dbgrid ke stringgrid atau yang lai  PostPosted: 13/Sep/2010 01:54
onKnowledgeable


Joined: 25-Jul-2008
Posts: 145

Status: Offline
dbgrid tidak memiliki property Cells, jadi gunakan datasource nya --> misal dari AdoQuery1 :

AdoQuery1.RecNo :=3;
Stringgrid1.Cells[1,3] := AdoQuery1.Findfield('data').asstring;
 
 View user's profile Send private message  
Reply with quote Back to top
theodorusapOffline
Location:
Post subject:   PostPosted: 19/Sep/2010 10:50
onNovice


Joined: 08-Dec-2009
Posts: 9

Status: Offline
Setuju sama mas Heriy4nt0 :

dbgrid tidak memiliki property Cells, jadi gunakan datasource nya --> misal dari AdoQuery1 :

code : pascal
  1. AdoQuery1.RecNo :=3;
  2. Stringgrid1.Cells[1,3] := AdoQuery1.Findfield('data').asstring;
Parsed in 0.001 seconds, using GeSHi


Atau, jika ingin mengambil data pada baris ke-3 kolom ke-1 maka bisa dibuat seperti ini :

code : pascal
  1. dbgrid1.datasource.dataset.recNo :=3;
  2. stringgrid1.cells[1,3] := dbgrid1.columns.item[1].field.asstring;
Parsed in 0.001 seconds, using GeSHi
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 12 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic





Powered by PNphpBB2 © 2003-2009 The Zafenio Team
Credits
RSS