?
Solved

ARRAY AND STRINGGRID

Posted on 2003-10-31
3
Medium Priority
?
722 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 540 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses
Course of the Month13 days, 10 hours left to enroll

749 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