Solved

ARRAY AND STRINGGRID

Posted on 2003-10-31
3
665 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

728 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