How do I force the spread to update from the Datasource.

Posted by: joe-customer on 8 September 2017, 2:53 pm EST

  • Posted 8 September 2017, 2:53 pm EST

    I'm using a simple List(Of SomeType) as my DataSource.

    The problem is, when I update an instance of asrLabelValues directly through code, it doesn't automatically update in the spread until I move to another row in the spread.

    I therefore need to be able to tell the spread to requery the bound data after I update one of the bound items directly through code instead of through the spread cells.

    What do I call to force the spread to re-query it's datasource and update itself?



         Private Sub BuildDatasource()




    _myDataSource =
    New
    List(
    Of asrLabelValues)




    _myDataSource.Add(
    New
    asrLabelValues
    With
    {.LabelSetName =
    "Zero", ...})




    _myDataSource.Add(
    New
    asrLabelValues
    With
    {.LabelSetName =
    "One", ...})




    _myDataSource.Add(
    New
    asrLabelValues
    With
    {.LabelSetName =
    "Two", ...})




    _myDataSource.Add(
    New
    asrLabelValues
    With
    {.LabelSetName =
    "Three", ...})



    _activeSheet.DataSource = _myDataSource

        
    End Sub





  • Replied 8 September 2017, 2:53 pm EST

    It seems the simplest solution is to just use .NET's BindingSource rather than List(Of ...)

    That also allows for calling ...

    BindingSource.ResetCurrentItem()

    or

    BindingSource.ResetBindings(False)

    Though I didn't find I needed to do that.

  • Replied 8 September 2017, 2:53 pm EST

    Hi,

    I think if you use BindingList instead, it will update automatically.  BindingList supports ListChanged notifications, but List does not.

Need extra support?

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

Learn More

Forum Channels