Sub DeleteEntry
Private Query As String
'''.........................................
SQL1.Initialize(File.DirInternal, "PHockey.db", True)
'''.........................................
Private Answ As Int
'ask the user for confirmation
Answ = Msgbox2("Do you really want to delete " & edtName.Text, "Delete entry", "Yes", "", "No", Null)
If Answ = DialogResponse.POSITIVE Then 'if yes, delete the entry
'''.........................................
Query = "DELETE FROM PHockey WHERE ID = " & Main.IDList.Get(Main.CurrentIndex)
Main.SQL1.ExecNonQuery(Query) 'delete the entry
Main.IDList.RemoveAt(Main.CurrentIndex) 'remove the ID from the list
If Main.CurrentIndex = Main.RowNumber - 1 Then 'if the current index is the last one
Main.CurrentIndex = Main.CurrentIndex - 1 'decrement it by 1
End If
Main.RowNumber = Main.RowNumber - 1 'decrement the row count by 1
ShowEntry(Main.CurrentIndex) 'show the next entry
ToastMessageShow("Entry deleted", False) 'confirmation for the user
ShowButtons
End If
End Sub
Private Query As String
'''.........................................
SQL1.Initialize(File.DirInternal, "PHockey.db", True)
'''.........................................
Private Answ As Int
'ask the user for confirmation
Answ = Msgbox2("Do you really want to delete " & edtName.Text, "Delete entry", "Yes", "", "No", Null)
If Answ = DialogResponse.POSITIVE Then 'if yes, delete the entry
'''.........................................
Query = "DELETE FROM PHockey WHERE ID = " & Main.IDList.Get(Main.CurrentIndex)
Main.SQL1.ExecNonQuery(Query) 'delete the entry
Main.IDList.RemoveAt(Main.CurrentIndex) 'remove the ID from the list
If Main.CurrentIndex = Main.RowNumber - 1 Then 'if the current index is the last one
Main.CurrentIndex = Main.CurrentIndex - 1 'decrement it by 1
End If
Main.RowNumber = Main.RowNumber - 1 'decrement the row count by 1
ShowEntry(Main.CurrentIndex) 'show the next entry
ToastMessageShow("Entry deleted", False) 'confirmation for the user
ShowButtons
End If
End Sub