Android Code Snippet [B4X] B4XTable - Delete Row

Discussion in 'Code Snippets' started by Erel, Mar 10, 2019.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Deletes a row from the table.

    Sub DeleteRow (tbl As B4XTable, RowId As Long)
    "DELETE FROM data WHERE rowid = ?"Array (RowId))
    Dim page As Int = tbl.CurrentPage
    Dim FirstIndex As Int = tbl.FirstRowIndex
    'Updates the rows count.
       If FirstIndex + 1 >= tbl.mCurrentCount Then
    page = page - 1
    End If
       tbl.CurrentPage = 
    End Sub
    Usage example:
    Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
    Dim sf As Object = xui.Msgbox2Async("Delete row?""Title""Yes""Cancel""No"Null)
    Wait For (sf) Msgbox_Result (Result As Int)
    If Result = xui.DialogResponse_Positive Then
           DeleteRow(B4XTable1, RowId)
    End If
    End Sub
    Last edited: Mar 11, 2019
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice