Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

I want to cancel the delete command please help me

$
0
0

Good day Geeks can I ask for some help please. In this statement............ If MsgBox("Are you sure that you want do delete this Question ?", MsgBoxStyle.OkCancel + MessageBoxIcon.Question, "Delete") = vbCancel Then I want to disable that execution of delete command... but I don't know the command ... I tried mycommand.cancel and it's not working .... below the then before else... thank you master.

Private Sub btndelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndelete.Click
        If txtqid.Text = "" OrElse txtquest.Text = "" OrElse txta.Text = "" OrElse txtb.Text = "" OrElse txtc.Text = "" OrElse txtd.Text = "" OrElse txtans.Text ="" OrElse txtstat.Text = "" Then
            MsgBox("Please the question that you want to be deleted.", MsgBoxStyle.OkOnly + MessageBoxIcon.Information, "Delete")
        Else
            Try

                conn.Open()
                mycommand = New OracleCommand("delete from question where question_ID = '" & txtqid.Text & "'", conn)
                mycommand.ExecuteNonQuery()
                conn.Close()

                If MsgBox("Are you sure that you want do delete this Question ?", MsgBoxStyle.OkCancel + MessageBoxIcon.Question, "Delete") = vbCancel Then

                Else
                    MsgBox("Question has been successfully deleted.", MsgBoxStyle.OkOnly + MessageBoxIcon.Information, "Deleted")
                End If

                ListView1.Refresh()
                ListView1.Items.Clear()
                refresher()
                txtqid.Text = ""
                txtquest.Text = ""
                txta.Text = ""
                txtb.Text = ""
                txtc.Text = ""
                txtd.Text = ""
                txtans.Text = ""
                txtstat.Text = ""

            Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        End If
    End Sub


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>