Checkbox and data in grid issue

Posted by: deepika.uchil on 12 November 2017, 5:36 pm EST

    • Post Options:
    • Link

    Posted 12 November 2017, 5:36 pm EST

    Hi,

    We have a FarSpread 8.0 grid and a couple of checkbox(not part of the grid, these are separate) on the same form.

    Based on the checkbox values data is added to the grid. For example each checkbox represents a day of the week, and the corresponding day should be added as a row in the grid, if checkbox is checked.

    But this is not working as intended, we are seeing random behavior. If all checkbox are checked then only Sunday is displayed in the gird, the rest of the days are not visible.

    The same code works fine in FarSpread 3.0 After upgrading to FarSpread 8.0 it is not working.

  • Posted 12 November 2017, 10:11 pm EST

    Hi Deepika,

    This issue looks like is specific to your use case. I don’t think I can recreate this at my end. Please provide me a sample application to debug this issue further.

    Thanks,

    Deepak Sharma

  • Posted 30 November 2017, 6:00 pm EST

    Hi Deepak,

    Please find attached sample project. I have added two grids : FarSpread 8.0 and FarSpread 3.0 for comparisons.

    Workflow :

    1. Check and Uncheck ‘Monday’ checkbox
    2. Check ‘All Days’ checkbox

    Result :

    In FarSpread 8.0 only Sunday is being displayed (ISSUE)

    In FarSpread 3.0 all days are being displayed correctly.

    FarSpread.zip

  • Posted 4 December 2017, 4:43 pm EST

    Hello,

    I have modified your code to get it to work for both Spread 8 and Spread 3. Please have a look at the attached sample application.

    Thanks,

    Deepak Sharma

    FarPointSpreadComCheck.zip

  • Posted 4 December 2017, 8:46 pm EST

    Hi Deepak,

    Thank you for your response. The basic scenarios are working after your changes. But the following scenario is not working with this code change :

    1. Check “All Days”
    2. Uncheck Monday/Tuesday
    3. Check “All Days”
    • Notice Monday/Tuesday are not added to the grid.(ISSUE)
  • Posted 5 December 2017, 10:19 pm EST

    Hello,

    I modified your code for Spread 8 like below and it works fine now:

    
    
    With spgrd1
           
            For lngRow = 1 To 7
                If chk(lngRow - 1).Value = vbChecked Then
                    .ReDraw = False
                    .Row = lngRow
                    .RowHidden = False
                    .Row = lngRow
                    .Col = DayType
                    .Lock = False
                Else
                    .Row = lngRow
                    .RowHidden = True
                    .Row = lngRow
                    .Col = DayType
                    .Text = " "
                    .Lock = True
                End If
            Next lngRow
                    .ReDraw = True
                    
          .Row = 1
          If .RowHidden = False Then
            .ShowCell 1, 1, PositionUpperLeft
          End If
          
        End With
    
    

    It does not scroll to top row automatically when the row is made visible again.

    Thanks,

    Deepak Sharma

  • Posted 5 December 2017, 11:35 pm EST

    Thanks Deepak.

  • Posted 6 December 2017, 7:20 pm EST

    Hi Deepika,

    Glad that I could help!

    Thanks,

    Deepak Sharma

  • Posted 2 January 2018, 8:01 pm EST

    Hi Deepak,

    The grid is still not working as excepted under specific scenarios. Below is the scenario:

    1. Check All Days
    2. Uncheck ‘Monday’ ‘Tuesday’ & ‘Wednesday’
    3. Now check ‘Wednesday’ (Not added to grid) (ISSUE)
    4. Check ‘Tuesday’ (Not added to grid) (ISSUE)
    5. Now if I check ‘Monday’ then the days are added as expected.
  • Posted 4 January 2018, 1:47 am EST

    Hi Deepika,

    The issue is not with Spread but the logic of the code written. I rewrite the code as follows and it works fine with the steps you have given above for Spread 8:

    
     With spgrd1
           
            For lngRow = 1 To 7
                If chk(lngRow - 1).Value = vbChecked Then
                    .ReDraw = False
                    .Row = lngRow
                    .RowHidden = False
                    .Row = lngRow
                    .Col = DayType
                    .Lock = False
                Else
                    .Row = lngRow
                    .RowHidden = True
                    .Row = lngRow
                    .Col = DayType
                    .Text = " "
                    .Lock = True
                End If
            Next lngRow
                    .ReDraw = True
                    
          .Row = 1
          If .RowHidden = False Then
          .ShowCell 1, 1, PositionUpperLeft
          End If
          .ShowCell 1, 1, PositionUpperLeft
        End With
    
    

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels