TstringGrid

hello,
How can i save all the emelents(i.e. ints) of TStringGrid into a matrix(non-square matrix)?
code,i wrote works for square matrix,but it doesnt works for non-square matrix...

Comments

  • : hello,
    : How can i save all the emelents(i.e. ints) of TStringGrid into a matrix(non-square matrix)?
    : code,i wrote works for square matrix,but it doesnt works for non-square matrix...

    What do you mean with 'matrix'? Do you mean a std::vector of std::vectors? And why would this 'matrix' only work when being square?

    If you don't know about std::vector, see www.codepedia.com/1/CppVector or look it up at www.codepedia.com/1/CppGlossary. I will give an easy example:

    [code]
    //WARNING: I might have swapped width and height, but you get the idea
    std::vector< std::vector > matrix;
    const int width = StringGrid->ColCount;
    const int height = StringGrid->RowCount;
    matrix.resize(width);
    for (int i=0; i<width; ++i)
    {
    matrix[i].resize(height)
    }
    [/code]

    Good luck,
    bilderbikkel

  • [b][red]This message was edited by rockstar_212 at 2006-1-11 8:36:34[/red][/b][hr]
    thanks !! i was going wrong with StrToInt now i took StrToFloat and everything is working well!!
    thanks once again
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories