Click here to Skip to main content
11,478,562 members (65,055 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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 at 21-Jan-13 1:50am
   
Have you set the delete command?
Ashok19r91d at 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
0 Sergey Alexandrovich Kryukov 209
1 F-ES Sitecore 170
2 Frankie-C 120
3 OriginalGriff 105
4 DamithSL 95
0 Sergey Alexandrovich Kryukov 7,865
1 OriginalGriff 7,341
2 Sascha Lefèvre 3,059
3 Maciej Los 2,491
4 Richard Deeming 2,335


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2015
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