D davelew1s Active Member Licensed User Longtime User Feb 7, 2014 #1 Hi! I am trying to delete 1 row in a tableview by clicking on column 2 using the following:- Sub tv1_SelectedCellChanged (RowIndex As Int, ColIndex As Int, Cell As Object) If ColIndex = 1 Then tv1 .Items .RemoveAt (tv1 .SelectedRow ) tv1.SelectedRow = -1 'If this line omitted all rows avove are deleted End If End Sub as it is it deletes 2 rows if ' tv1.SelectedRow = -1 ' is not in it deletes all rows above the selected one. Any help or thought on this . Thanks Dave.
Hi! I am trying to delete 1 row in a tableview by clicking on column 2 using the following:- Sub tv1_SelectedCellChanged (RowIndex As Int, ColIndex As Int, Cell As Object) If ColIndex = 1 Then tv1 .Items .RemoveAt (tv1 .SelectedRow ) tv1.SelectedRow = -1 'If this line omitted all rows avove are deleted End If End Sub as it is it deletes 2 rows if ' tv1.SelectedRow = -1 ' is not in it deletes all rows above the selected one. Any help or thought on this . Thanks Dave.
Erel B4X founder Staff member Licensed User Longtime User Feb 9, 2014 #2 Please use [ code ] [ /code ] tags (without spaces) when posting code. I guess that it first deletes the current selected row and then the selected row changes and it deletes it as well (because the event is fired again). Upvote 0
Please use [ code ] [ /code ] tags (without spaces) when posting code. I guess that it first deletes the current selected row and then the selected row changes and it deletes it as well (because the event is fired again).
D davelew1s Active Member Licensed User Longtime User Feb 9, 2014 #3 Sorry Erel won't happen again...after alot of playing I got it to work ok as follows:- Code: Copy Sub tv1_SelectedCellChanged (RowIndex As Int, ColIndex As Int, Cell As Object) If ColIndex = 1 Then tv1 .SingleCellSelection = False tv1 .Items .RemoveAt (tv1 .SelectedRow ) tv1 .SingleCellSelection =true End If End Sub Dave. Upvote 0
Sorry Erel won't happen again...after alot of playing I got it to work ok as follows:- Code: Copy Sub tv1_SelectedCellChanged (RowIndex As Int, ColIndex As Int, Cell As Object) If ColIndex = 1 Then tv1 .SingleCellSelection = False tv1 .Items .RemoveAt (tv1 .SelectedRow ) tv1 .SingleCellSelection =true End If End Sub Dave.