Posted 25 June 2023, 9:16 pm EST
I’m setting my grid:
AllowAddNew = true
Rows.Fixed = 1
Rows.Count = 4
When I reset Rows.Count = Rows.Fixed it throwing ‘Index out of range exception.’
Forums Home / ComponentOne / WinForms Edition
Posted by: dung.itcdt on 25 June 2023, 9:16 pm EST
Posted 25 June 2023, 9:16 pm EST
I’m setting my grid:
AllowAddNew = true
Rows.Fixed = 1
Rows.Count = 4
When I reset Rows.Count = Rows.Fixed it throwing ‘Index out of range exception.’
Posted 26 June 2023, 1:24 am EST
Hi,
We tested your code with the latest 2023v1(603) version of C1FlexGrid and did not see any errors on our end. Please see the attached sample project for reference. If you are doing something different, please provide a sample project or update the attached project to reproduce the error, so we can investigate further and assist you in the best way possible. Also, let us know the version of C1FlexGrid you are using.
JYFI, the Rows.Fixed = 1 by default. Setting AllowAddNew = true requires one extra row in the C1FlexGrid and it is not recommended to set the Rows.Count = Rows.Fixed as Rows.Count should ideally be 2 i.e. one for column headers and the other for the NewRow. Instead of setting Rows.Count = Rows.Fixed, you should set Rows.Count = Rows.Fixed + 1
Attachment: FlexGridSample.zip
Thanks, and Best Regards,
Kartik
Posted 27 June 2023, 2:09 am EST
I’m sorry for my mistake. If set Rows.Count = 0 will be throwing Index out of range exception.
Posted 27 June 2023, 4:11 am EST
Hi,
Thank you for providing the details. We could see the issue on our end. We have reported the issue to the development team for further investigation and will let you know the updates as soon as possible.
In the meantime, since the AllowAddNew = true requires an extra row, if you want to clear all the rows in the C1FlexGrid, set the AllowAddNew = false before setting the Rows.Count = 0. If you still face any issues, please let us know your implementation/use-case and we will try to come up with a temporary workaround.
[Internal Tracking ID: C1WIN-30616]
Best Regards,
Kartik
Posted 12 July 2023, 6:43 am EST
Hi,
Could you please share what are you trying to implement by setting the number of rows to 0 with AllowAddNew enabled? Because as mentioned earlier, enabled AllowAddNew means that there can’t be less than 1 row in the grid.
If you have a valid use case/implementation, let us know and we will pass it on to the development team for further investigation.
Best Regards,
Kartik