Click here to Skip to main content
12,068,141 members (48,978 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
There is a combobox and a delete button in my form. when i click the delete button i want to get a confirmation message from the item values which are more than 10,000.
but there is an error.
here is my code for delete button:
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
        If ds.Tables("ItemList").Rows(ComboBox1.SelectedIndex).Item(1) > 10000 Then
            MessageBox.Show("Do you really want to Delete this Record?", "Confirm Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
 
            If DialogResult.No Then
                MsgBox("Operation Cancelled")
            Else
                Dim cb As New OleDb.OleDbCommandBuilder(da)
                ds.Tables("ItemList").Rows(ComboBox1.SelectedIndex).Delete()
                da.Update(ds, "ItemList")
                fillComboBox()
 
                Exit Sub
            End If
        End If

according to that when the confirmation msg comes if i click no button the proper msg comes. but if i click the yes button the item should delete from the combobox. but the item doesn't delete when i clicked yes button
can somebody find me the issue?
Posted 20-Jan-13 20:45pm
Comments
d@nish 21-Jan-13 1:50am
   
Have you set the delete command?
Ashok19r91d 21-Jan-13 2:47am
   
You Provide Necessary Description to Understand Your Problem, But...
Code You Provide is not Enough to Identify Error Source and Problem, Consider Updating All Code Associated with Your Current Module...

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Put a debug point on the first line of the method and then once the code executes, debug from this point.
You should get the error message details as well as the location of the error.

This will help you identify what the error could be.

If you cannot identify the cause of the error, modify and post the error message in your question above so that someone can try and help you.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160208.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100