Hi,
I have an ultragrid where the datasource is bound to a bindinglist. When adding a new item to the bindinglist the ultragrid is correctly updated. What I want to do is to activate/select the row of the newly added item.
Is there a short way to do this.
I know the BindingList object so the ListObject of the row is known in the grid but I can't find a function to directly select the row using the listObject.
Right know I loop through all rows searching for the correct ListObject
Ok thanks that was the solution
Use the IndexOf method of your BidningList to get the index. For example if List is your BindingList, then your code would be something like:
row = gridSelector.Rows.GetRowWithListIndex(List.IndexOf(ListObject))
GetRowWithListIndex asks for the index from the object in the bindinglist. I'm searching for a function where I can give the object from the bindinglist as parameter and that returns the Row from the ultragrid corresponding to that object.
Right now I'm looping the whole list
For Each row As UltraGridRow In gridSelector.Rows If row.ListObject.Equals(newComboBoxItem) Then row.Activate() Exit For End IfNext
You can use the ListObject to get the index from the BindingList that you are bound to and then use the GetRowWithListIndex method from the RowsCollection to get the Row in the UltraGrid. Once you have the row, you can call the Activate method on the row.