出現'''is not a volid integer value'錯誤 |
缺席
|
iii0628
一般會員 ![]() ![]() 發表:50 回覆:46 積分:19 註冊:2005-04-04 發送簡訊給我 |
請問我現在的程式是第一段的話執行上沒有錯誤,為何我將StringGrid1的ROW加大內容之後,就會出現錯誤(ROW只要超過180就會出錯)。可以幫我看看嗎???
我已經找好久都無法解刁....謝謝
第一段
StringGrid1的RowCout=37 StringGrid1的ColCout=39 __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { int i, j; //設定Row Header 以及Column Header的數字 for (i = 0 ; i <= 38 ; i ) { StringGrid1->Cells[i][0] = IntToStr(i); StringGrid2->Cells[i][0] = IntToStr(i); } for (j = 0 ; j <= 36 ; j ) { StringGrid2->Cells[0][j] = IntToStr(j); } for (j = 0 ; j <= 72 ; j ) { StringGrid1->Cells[0][j] = IntToStr(j); } for(int col=1;col<=38;col ){ for(int row=1;row<=72;row ){ StringGrid1->Cells[col][row] =3; StringGrid2->Cells[col][row] =0; } } } //--------------------------------------------------------------------------- void __fastcall TForm1::BitBtn1Click(TObject *Sender) { int row=0, col=0; // 供處理行列資料的迴圈使用 int rowstep =0; int restartRow=0; // 每次重新處理的第一行 (row) 編號 int processRows = 0; // 存放處理行數 (rows) 的累加數字 int tmpNum; // 暫存用之變數 rowstep =(StringGrid1->RowCount-1) / 36; // 將總行數 (rows) 除以 36 做為迴圈的計算基底 for (restartRow=1; restartRow<=36; restartRow ) { // 處理 36 次 for (row=restartRow; row<=(restartRow 35)*(rowstep-1) 1; row =36) { // 每次隔 36 行 (rows) // processRows ; // 累加處理行數 (rows) // if (processRows > (StringGrid1->RowCount-1)) { // 若超過處理範圍就跳出迴圈 // break; // } for (col=1; col<=38; col ) { // 逐欄 (column) 比對 if (StrToInt(StringGrid1->Cells[col][row]) > 1) { // 若比對欄位的數字大於 1 tmpNum = StrToInt(StringGrid2->Cells[col][restartRow]) 1; // 取得 StringGrid2 對應欄位的數字並加 1 StringGrid2->Cells[col][restartRow] = tmpNum; // 回存累加數字 } } } } }第二段 StringGrid1的RowCout=181 StringGrid1的ColCout=39 __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { int i, j; //設定Row Header 以及Column Header的數字 for (i = 0 ; i <= 38 ; i ) { StringGrid1->Cells[i][0] = IntToStr(i); StringGrid2->Cells[i][0] = IntToStr(i); } for (j = 0 ; j <= 36 ; j ) { StringGrid2->Cells[0][j] = IntToStr(j); } for (j = 0 ; j <= 180 ; j ) { StringGrid1->Cells[0][j] = IntToStr(j); } for(int col=1;col<=38;col ){ for(int row=1;row<=180;row ){ StringGrid1->Cells[col][row] =3; StringGrid2->Cells[col][row] =0; } } } //--------------------------------------------------------------------------- void __fastcall TForm1::BitBtn1Click(TObject *Sender) { int row=0, col=0; // 供處理行列資料的迴圈使用 int rowstep =0; int restartRow=0; // 每次重新處理的第一行 (row) 編號 int processRows = 0; // 存放處理行數 (rows) 的累加數字 int tmpNum; // 暫存用之變數 rowstep =(StringGrid1->RowCount-1) / 36; // 將總行數 (rows) 除以 36 做為迴圈的計算基底 for (restartRow=1; restartRow<=36; restartRow ) { // 處理 36 次 for (row=restartRow; row<=(restartRow 35)*(rowstep-1) 1; row =36) { // 每次隔 36 行 (rows) // processRows ; // 累加處理行數 (rows) // if (processRows > (StringGrid1->RowCount-1)) { // 若超過處理範圍就跳出迴圈 // break; // } for (col=1; col<=38; col ) { // 逐欄 (column) 比對 if (StrToInt(StringGrid1->Cells[col][row]) > 1) { // 若比對欄位的數字大於 1 tmpNum = StrToInt(StringGrid2->Cells[col][restartRow]) 1; // 取得 StringGrid2 對應欄位的數字並加 1 StringGrid2->Cells[col][restartRow] = tmpNum; // 回存累加數字 } } } } } [/code] |
taishyang
站務副站長 ![]() ![]() ![]() ![]() ![]() ![]() 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
|
iii0628
一般會員 ![]() ![]() 發表:50 回覆:46 積分:19 註冊:2005-04-04 發送簡訊給我 |
|
taishyang
站務副站長 ![]() ![]() ![]() ![]() ![]() ![]() 發表:377 回覆:5490 積分:4563 註冊:2002-10-08 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |