AllenJ
2017-02-03T17:42:10Z
I have code to save the data of an igrid control to a data file.
The igrid uses check boxes in some of the cells.
When I reload the form data, the check boxes always restore as checked, not unchecked.
How can I get it to set the correct state of check boxes as checked or unchecked?

The data format (CelList in code below):

<IGrid1>5|12|1|True||Continuous|Live|0.280|0.000|||||&lt;empty&gt;|2|False|False|Point|Live|0.000|43.800|||29||&lt;empty&gt;|3|True|False|Point|Live|0|43.800|||49||&lt;empty&gt;|4|True|False|Point|Live|3.6|&lt;empty&gt;|||22.67||&lt;empty&gt;|5|True|True|Point|Live|3.6|&lt;empty&gt;|||45.33||&lt;empty&gt;|</IGrid1>

What is saved:

[img=https://drive.google.com/file/d/0B6g56LjIUheNQmZrRVFsQmV1OVk/view?usp=sharing]Saved[/img]

What is restored:

[img=https://drive.google.com/file/d/0B6g56LjIUheNcVNEQUJpdkhlVVU/view?usp=sharing]Restored[/img]

The code to restore the data:


 Dim oGrid As TenTec.Windows.iGridLib.iGrid = CType(oChild, TenTec.Windows.iGridLib.iGrid)
                If oGrid.ReadOnly = False Then
                    Dim DL As String = "|", CelList() As String = Split(controlValue, DL), ci As Integer = 2
                    If CelList.Length > 3 Then
                        oGrid.Rows.Count = CInt(CelList(0))
                        oGrid.Cols.Count = CInt(CelList(1))
                        For r As Integer = 0 To oGrid.Rows.Count - 1
                            For c As Integer = 0 To oGrid.Cols.Count - 1
                                If CelList(ci) <> "<empty>" Then
                                    oGrid.Cells(r, c).Value = CelList(ci)
                                    'If CelList(ci) = "True" Then
                                    '    oGrid.Cells(r, c).Value = TenTec.Windows.iGridLib.iGBool.True
                                    'ElseIf CelList(ci) = "False" Then
                                    '    oGrid.Cells(r, c).Value = TenTec.Windows.iGridLib.iGBool.False
                                    'Else
                                    '    oGrid.Cells(r, c).Value = CelList(ci)
                                    'End If
                                End If
                                ci += 1
                            Next
                        Next
                    End If
                End If

Note I commented out code that didn't seem to work.
Igor/10Tec
2017-02-06T09:26:58Z
We need a sample to reproduce the problem. Can you prepare and mail it to our support address?
AllenJ
2017-02-06T14:59:46Z
  WindowsApplication1.zip (453kb) downloaded 188 time(s).

I emailed, but it claimed the attachment had a virus.

When the check box columns (Active & Brace) are set to Text Style, the values True and False appear correctly, but when set to Check style they all appear checked.
The Last.zzz file contains the data for the Igrid.
Igor/10Tec
2017-02-06T15:18:53Z
Thank you for the sample. It helped to understand what is wrong.

The 3-state specific iGBool type is used to specify values for some properties that may inherit values from their parents - for instance, iGCellStyle.ReadOnly. However, the iGBool values are not used to control the state of the cell check box. You need to use the traditional Boolean True/False for that.

The corresponding part of your code should look like this:

If CelList(ci) = "True" Then
    oGrid.Cells(r, c).Value = True
ElseIf CelList(ci) = "False" Then
    oGrid.Cells(r, c).Value = False
Else
    oGrid.Cells(r, c).Value = CelList(ci)
End If


P.S. Don't email archives with executable contents, i.e. the Bin & Obj folders in the case of VS solutions (they can be recreated during compilation). Most likely, they were considered a virus by the anti-spam system.