Prof. Stevan Djuranovic wrote:
> I haven't work with StringGrid. I know little about it.

I've never used it, either. But I can figure it out pretty fast by 
looking in the help file. It has several properties for accessing its 
contents. Start with the Rows, Cols, Cells, RowCount, and ColCount 
properties.

> First, there are 90 numbers in this stringgrid.
> Next step, delete 24 numbers (now we get 24 empty cells and rest are numbers)

Do you have to do that step? In your previous message, you made it sound 
like that part had already been done.

> I just need code to take one or more number(s) from one row
> and place it in another row. There are 6 rows and 15 columns.

Grid.Cells[a, b] := Grid.Cells[c, d];
Grid.Cells[c, d] := '';

That takes care of moving a value from one cell to another. Now all you 
have to do is detemine good values for A, B, C, and D.

> At the end I must have four empty cells in every row and 66 numbers from 
> begining.

Here's a two-pass algorithm.

For each row that has more than 11 non-empty cells, take the contents of 
the extra cells and put them in a TStringList. Clear those cells as you 
put them into the list.

Next, for each row that has more than four empty cells, take a string 
out of the string list and put it in one of the empty cells until that 
row has exactly four empty cells.

Does that sound like something you can do?

It's possible to do this in a single pass, but that requires a slightly 
more complicated data structure, which I think is beyond your current 
skill level.

-- 
Rob


-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to