LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

reentering values in a table

I have an application in which i enter data in a table as user enters it.when user clicks on clear(a command button) i delete all the rows using DeleteTableRows in a loop,but the problem arises when again i try to enter data in same table,during the same run.  It shows me an error that index passed out of range (library error -55). how can i enter values in table??
 
I am enclosing a text file which contains the code for data entry and removal.
 
with regards,
akath
0 Kudos
Message 1 of 8
(4,078 Views)
DeleteTableRows actually removes rows from the table, so when you try to access a cell in a row that has been removed you get that error. You should instead clear all deta by putting an appropriate "default" value of your choice in every cell using FillTableCellRange (this command assumes all cells in the range share the same data type: in case your cells are of different types you will need to repeat the command for each range with unique data type).


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 8
(4,068 Views)

thanks for your reply,

but what iam doing is that after deleting the rows i again start filling the table from first row(i.e. refilling the same table).I donot try to access the deleted elements.

with regards ,

akath

0 Kudos
Message 3 of 8
(4,063 Views)
This is your code:
 
while (x > 0) {
  DeleteTableRows (panelhandle1, LIVE_TABLE, x, 1);
  x--;
}
x = 1;
The question is how you set initial value of 'x': if it comes from previous function to fill the table, it equals the number of row lines in the table. If this is true, you are deleting all rows from the table...
Try setting different values of x (for example set it to GetNumTableRows - 1) and see if all works well.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 8
(4,057 Views)
hi   Roberto,
thanks for your reply.I am deleting the whole table only,so the i value has been set to 1(the starting of the table).
i tried ur suggestions to but none worked.
 
akath
0 Kudos
Message 5 of 8
(4,014 Views)
akath, try commenting out the lines that fill again the table after deletion and look at the table after the Clear button callback: do some row stil remains in it? If yes you should be able to address it with the correct index; if not, you will need to add a new line befor enterning the values in it.
BTW, you could consider to delete all the required rows with a single instructions passing the appropriate NumberOfRows to DeleteTableRows ().


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 8
(4,005 Views)
Thanks a lot Roberto , you solved my problem, Actually after deleting the table i was not making the first row which was giving me the error.
Now the code runs perfectely.
 
regards
akath 
0 Kudos
Message 7 of 8
(3,984 Views)
You're welcome! Smiley Happy


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 8 of 8
(3,974 Views)