Solved

ARRAY AND STRINGGRID

Posted on 2003-10-31
3
634 Views
Last Modified: 2010-04-05
I have array of integer (72row  3col)...
I have stringgrid(11row 3col)...
Now I want from array to read each grid1[0,grdrow] and
put the value of myarray[aryrow,3] in grid1[1,grdrow]...
I  try this code but no action:-

//******************************************

  listR220(myarray);          //display the value of array

    for grdrow:= 1 to Grid1.RowCount -1 do
         for aryrow := 1 to 72 do
         begin
            if strToint(Grid1.cells[0,grdrow])=myarray[aryrow,3] then
               begin
               Grid1.cells[1,grdrow]:=inttostr( myarray[aryrow,3]);
               end;
          end;
0
Comment
Question by:sal1150
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
geobul earned 135 total points
ID: 9661388
Hi,

I can't get what you are doing but obviously the condition is evaluating to false every time:
    if strToint(Grid1.cells[0,grdrow])=myarray[aryrow,3] then

i.e. there is no match between these two integers in your data. To make yourself sure that the code is doing what you want:
1. clear all grid cells in the second column (index 1) ;
2. enter at least one value from myarray(?,3) in one grid cell (first column - index 0);
3. run the code above again and that value from 2. has to appear in grid column 2.

Regards, Geo
0
 

Author Comment

by:sal1150
ID: 9662242
Hi geobul
Before I am asking I do same your steps but no it is not working!
So is there any solution

1-my data store in array
2-I enter some value in col 0 in grid1
3-I want to fill col 1 in grid1 from array
4-If grid1.cell[0,row] = myarray(?,3) then write equivlant value in col 1
0
 

Author Comment

by:sal1150
ID: 9662268
Hi geobul
It is true ,there is no match between these two integers in my data...

I must combare between firs col of grid and first col of array and put the value of third col of array in col 1 of grid..

 the corrcted code will be same this:-

listR220(myarray);          //display the value of array

  for aryrow := 1 to 72 do
     for grdrow:= 1 to Grid1.RowCount -1 do  
         begin
            if strToint(Grid1.cells[0,grdrow])=myarray[aryrow,1] then
               begin
               Grid1.cells[1,grdrow]:=inttostr( myarray[aryrow,3]);
               end;
          end;
//***************************thanks geobul
and all points will shift to u.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question