Ok here is some background to my setup.
I have a WinForms App which takes to a Backend via RestAPI. In this case the user searches for some data andwe send of Rest Query to Server and get Data Back in Json. We then populate a Data Class and pass it to a new Window which has the Ultra Grid on it. All works fine for the initial query. If i send updated Data to that form my class shows the correct count but the grid never updates.
Here is how i declare my Data on Form
Public myData As New List(Of CustomerData.Customer_Search_Result)
on Form Load i bind Grid to Data
ugCustomerSearchResult.DataSource = myData
i tried
ugCustomerSearchResult.Rows.Refresh(RefreshRow.ReloadData)
only thing that works for me is to unbind and rebind but i doubt that's a good approach
ugCustomerSearchResult.DataSource = NothingugCustomerSearchResult.DataSource = myData
So how can i either have the Grid reload if the myData changes automatically or if that's not possible how to tell grid to reload / refresh the data
Hello,
Thank you for the info.
Based on what you provided, it seems like CustomerList is a new instance. In that case, setting the DataSource is the correct approach.
Calling ugCustomerSearchResult.Rows.Refresh(RefreshRow.ReloadData) would work if you were updating the original CustomerList and not creating a new instance.
If you have any further questions or concerns with this, please let me know.
in my case i have a Search Form which handles all the RestAPI calls and passes the result back to the myData on the form which has the grid
.
If Application.OpenForms().OfType(Of frmCustomerSearchResult).Any Then tsslStatus.Text = CustomerList.Count & " Records found !" txtCustFound.Text = CustomerList.Count frmCustomerSearchResult.reloadData(CustomerList) Else tsslStatus.Text = CustomerList.Count & " Records found !" txtCustFound.Text = CustomerList.Count frmCustomerSearchResult.myData = CustomerList frmCustomerSearchResult.Show() End If
And for now i handle it like this on the CustomerSearchResult Form
Public Sub reloadData(newData As List(Of CustomerData.Customer_Search_Result)) myData = newData ugCustomerSearchResult.DataSource = Nothing ugCustomerSearchResult.DataSource = myData End Sub
it works but i dont think its the ideal way
Thank you for posting in our forums!
When you are updating your data, how are you achieving this? Are you creating a new instance of a List, or updating the values within myData?
Is there a more complete code snippet of this functionality you can provide that will help me better understand the use case?
Looking forward to hearing from you.