Setting a CheckboxC...
 

Setting a CheckboxColumn in code  

   RSS

0

Hi, I parsing a JSONItem and need to set the valve of a checkbox to checked or unchecked, but I can't seem to find the correct way to do this, 

The Column (col) is defined with

DataView1.ColumnType(col)=piDogDataView.DataView.TypeCheckBox

I've tried

These Error with Errors with There is more than one item with this name and it's not clear to which this refers.

DataView1.CellCheck( row, col, 1) 

DataView1.CellCheck( row, col, CheckBox.CheckedStates.Checked)

DataView1.Cell(row, col) = DataView1.CellState( row, col, CheckBox.CheckBoxUnchecked)

DataView1.Cell(row, col) = piDogDataView.DataView.CellState( row, col, CheckBox.CheckBoxChecked)

DataView1.Cell(row, col, CheckBox.CheckedStates.Checked )

 

this one doesn't error but doesn't tick the check box

DataView1.Cell(row, col) = CheckBox.CheckedStates.Checked

I'd be really grateful for a little help,

thank you

I'm sure I tried this before, but a new day with fresh eyes
DataView1.CellState(row,col)=CheckBox.CheckedStates.Checked
Works
thank you

Topic Tags
1 Answer
0

Hi Sarah,

Glad you found the solution!

Another way would be to set 

DataView1.CellCheck(row,col)=True

You can also browse the DataView class inside: DataView_Folder/piDogDataView_Folder/piDogDataView/Classes/DataView

 

 

@jim

ooh thats so much neater and quicker 🙂
What I was doing was to wrap the JSONItem value in an if else statement like below, now I don't, I can use 1 line. I've posted it just incase someone else as dumb as me is struggling 🙂

( optionItem is the JSON Item and I'm looping through them to find specific names to do specific things with)

DataView1.CellCheck(row,col)=optionItem.Value(optionItem.Name(col)).BooleanValue
Instead of
If optionItem.Value("Active") = 1 Then
'//DataView1.CellState(row,col)=CheckBox.CheckedStates.Checked
'DataView1.CellCheck(row,col)=True
'Else
'DataView1.CellCheck(row,col)=False
'End If
thank you so much

Share:

Please Login or Register