LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with GetTableCellValue

Hello,

I created a table that the user must fill. When the button "Go" is pressed, I want to read the cells one by one and send the content to the RS232 port. But each time this error appears :

 NON-FATAL RUN-TIME ERROR:   "Interface_Profils.c", line 99, col 34, thread id 0x00000CF4:   Library function error (return value == -55 [0xffffffc9]). The index passed is out of range

It comes from the GetTableCellValue function... Can somebody explain to me what's the problem ?

Thanks!
CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 1 of 5
(3,669 Views)

Hello,

What is the value that you pass to the Cell parameter of the GetTableCellVal function? Note that the indices are not zero-based but 1-based. The first Point index represents the column number (range: 1 to number of columns). The second Point index represents the row number (range: 1 to number of rows).

 

Message 2 of 5
(3,666 Views)

Hello again,

I haven't tested it, but this piece of code should work fine:

GetNumTableColumns (pnlHandle, PNL_TABLE, &num_columns);
GetNumTableRows (pnlHandle, PNL_TABLE, &num_rows);
for (row_cntr = 1; row_cntr <= num_rows; row_cntr++){
        for (column_cntr = 1; column_cntr <= num_columns; column_cntr++){
                GetTableCellVal (pnlHandle, PNL_TABLE, MakePoint (column_cntr, row_cntr), string);
                num_bytes = ComWrt (port_nr, string, strlen (string));;
                if (num_bytes < 0){
                        MessagePopup ("Error", GetRS232ErrorString (num_bytes));
                        return 0;
                }
        }
}

Message 3 of 5
(3,664 Views)
I attached my C code so you can see how I use. This code is very basic and not optimized at all...
CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 4 of 5
(3,661 Views)
Thank you for your answer ! In fact I just inverted the rows and columns in the MakePoint function... THanks a lot for your help !
CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 5 of 5
(3,658 Views)