[Gambas-user] Need help on dataview

T Lee Davidson t.lee.davidson at gmail.com
Fri Mar 11 18:36:31 CET 2022


On 3/11/22 04:23, Fabien Bodard wrote:
> Hi,
> 
> 
> I want to maintain the position of  the selected line after an update
> of the datasource ... How can I do that ?
> 
> I take any good idea :-)
> 
> There is no data count change just dataline info change ... but when I
> call datasource.update , the dataview loose the position ... and the
> index ...
> 

Since you are calling Datasource.Update manually, you have the opportunity to store the index prior to updating. Then, just 
restore it after the update. Simple. Or, did I miss something?

[code]
Public Sub btnUpdate_Click()

   Dim iIndex As Integer

   iIndex = DataView1.Index
   DataView1.Update
   DataView1.MoveTo(iIndex)

End
[/code]


-- 
Lee


More information about the User mailing list