Solved

ARRAY AND STRINGGRID

Posted on 2003-10-31
3
621 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now