ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2014-10-26 19:04:02

dariex
Member
Registered: 2014-10-20
Posts: 13

Get back checkboxcell value

Hi Jing,
Thanks again for your great control. I have a problem regarding checkboxcell object.
VB.Net code:

Dim cbCell As unvell.ReoGrid.CellTypes.CheckBoxCell = New unvell.ReoGrid.CellTypes.CheckBoxCell
_Grid.CurrentWorksheet(_Grid.CurrentWorksheet.GetNamedRange("Name").Range) = cbCell
cbCell.Checked = True

So is there some way to get back CheckBoxCell object from the reogrid to retrieve some properties of the checkbox object?

P.S. I have lot's of checkboxes inside reogrid and I don't want to save references of that objects for later access, so it would be nice if I could get this objects form my reogrid object later, say in form close event. I tried several way to cast back to checkboxcell but without any success. Please help me.

Regards,
Ilia Mamukashvili,
Tbilisi, Georgia

Last edited by dariex (2014-10-26 19:06:39)

Offline

#2 2014-11-06 03:40:59

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Get back checkboxcell value

Hi, All cell bodies use its cell's data directly. It's possible to set cell's data to true to change checkbox, it's also possible to get cell's data from checkbox directly.

Dim sheet = grid.CurrentWorksheet

' add checkbox
sheet("A1") = New CheckBoxCell

' check
sheet("A1") = True

' uncheck
sheet("A1") = False

' get value back
Dim checked As Boolean = DirectCast(sheet("A1"), Boolean)

' display value
MessageBox.Show(checked.ToString())

As you expected, there is no need to keep all references to checkbox, just keep grid instance, and get the cell value like a normal cell value, that is the value of checkbox.

And, another feature that might be useful for you. To add a lot of checkbox, no need to add them into cells one by one, you could just set the DefaultCellBody of ColumnHeader, when the cell's value is set to a Boolean value, true or false, the checkbox will appear automatically. Please see 'Column Cells Type' section in this page: http://reogrid.net/document/row-and-column/

Last edited by Jingwood (2014-11-06 03:53:14)

Offline

Board footer

Powered by FluxBB