Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. DOH!!!

DOH!!!

Scheduled Pinned Locked Moved The Lounge
helpquestionbeta-testing
37 Posts 23 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Kevin Marois

    This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

    private void DeleteSelectedRows()
    {
    if (accountsUltraGrid.Selected.Rows.Count > 0)
    {
    string message = "Are you sure you want to delete the selected accounts?";
    if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
    {
    foreach (var gridRow in accountsUltraGrid.Selected.Rows)
    {
    Account account = gridRow.ListObject as Account;

                host.GetProxy().DeleteAccount(account);
                totalRowCount--;
            }
        }
    }
    

    }

    If it's not broken, fix it until it is

    C Offline
    C Offline
    Chris Maunder
    wrote on last edited by
    #9

    :doh: Been there, done that. :beer: time.

    cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

    L 1 Reply Last reply
    0
    • K Kevin Marois

      This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

      private void DeleteSelectedRows()
      {
      if (accountsUltraGrid.Selected.Rows.Count > 0)
      {
      string message = "Are you sure you want to delete the selected accounts?";
      if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
      {
      foreach (var gridRow in accountsUltraGrid.Selected.Rows)
      {
      Account account = gridRow.ListObject as Account;

                  host.GetProxy().DeleteAccount(account);
                  totalRowCount--;
              }
          }
      }
      

      }

      If it's not broken, fix it until it is

      W Offline
      W Offline
      Wonde Tadesse
      wrote on last edited by
      #10

      if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ; // One statement due to ;

      { // Second statement.
      foreach (var gridRow in accountsUltraGrid.Selected.Rows)
      {
      Account account = gridRow.ListObject as Account;

          host.GetProxy().DeleteAccount(account);
          totalRowCount--;
      }
      

      }

      It happens sometimes such cranky bugs.

      Wonde Tadesse

      1 Reply Last reply
      0
      • K Kevin Marois

        This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

        private void DeleteSelectedRows()
        {
        if (accountsUltraGrid.Selected.Rows.Count > 0)
        {
        string message = "Are you sure you want to delete the selected accounts?";
        if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
        {
        foreach (var gridRow in accountsUltraGrid.Selected.Rows)
        {
        Account account = gridRow.ListObject as Account;

                    host.GetProxy().DeleteAccount(account);
                    totalRowCount--;
                }
            }
        }
        

        }

        If it's not broken, fix it until it is

        S Offline
        S Offline
        SoMad
        wrote on last edited by
        #11

        I have done that too. It is one of those bugs that can be very hard to track down. Soren Madsen

        1 Reply Last reply
        0
        • K Kevin Marois

          This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

          private void DeleteSelectedRows()
          {
          if (accountsUltraGrid.Selected.Rows.Count > 0)
          {
          string message = "Are you sure you want to delete the selected accounts?";
          if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
          {
          foreach (var gridRow in accountsUltraGrid.Selected.Rows)
          {
          Account account = gridRow.ListObject as Account;

                      host.GetProxy().DeleteAccount(account);
                      totalRowCount--;
                  }
              }
          }
          

          }

          If it's not broken, fix it until it is

          R Offline
          R Offline
          Rajesh R Subramanian
          wrote on last edited by
          #12

          Was the semi colon put in accidentally after all the code was written, or did the VS editor formatted the braces in place for the IF condition in spite of the semi colon? :omg:

          "Real men drive manual transmission" - Rajesh.

          1 Reply Last reply
          0
          • C Chris Maunder

            :doh: Been there, done that. :beer: time.

            cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #13

            Chris Maunder wrote:

            [beer] time.

            Schmiddy of light?

            Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

            L 1 Reply Last reply
            0
            • K Kevin Marois

              This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

              private void DeleteSelectedRows()
              {
              if (accountsUltraGrid.Selected.Rows.Count > 0)
              {
              string message = "Are you sure you want to delete the selected accounts?";
              if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
              {
              foreach (var gridRow in accountsUltraGrid.Selected.Rows)
              {
              Account account = gridRow.ListObject as Account;

                          host.GetProxy().DeleteAccount(account);
                          totalRowCount--;
                      }
                  }
              }
              

              }

              If it's not broken, fix it until it is

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #14

              It's terrible when your semi colon ends up dangling.

              *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

              "Mind bleach! Send me mind bleach!" - Nagy Vilmos

              CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

              1 Reply Last reply
              0
              • K Kevin Marois

                This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

                private void DeleteSelectedRows()
                {
                if (accountsUltraGrid.Selected.Rows.Count > 0)
                {
                string message = "Are you sure you want to delete the selected accounts?";
                if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
                {
                foreach (var gridRow in accountsUltraGrid.Selected.Rows)
                {
                Account account = gridRow.ListObject as Account;

                            host.GetProxy().DeleteAccount(account);
                            totalRowCount--;
                        }
                    }
                }
                

                }

                If it's not broken, fix it until it is

                V Offline
                V Offline
                V 0
                wrote on last edited by
                #15

                without having looked at the previous answers I say just remove the ";" at the end of the if statement. subtle. ;)

                V.
                (MQOTD Rules and previous Solutions )

                1 Reply Last reply
                0
                • K Kevin Marois

                  This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

                  private void DeleteSelectedRows()
                  {
                  if (accountsUltraGrid.Selected.Rows.Count > 0)
                  {
                  string message = "Are you sure you want to delete the selected accounts?";
                  if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
                  {
                  foreach (var gridRow in accountsUltraGrid.Selected.Rows)
                  {
                  Account account = gridRow.ListObject as Account;

                              host.GetProxy().DeleteAccount(account);
                              totalRowCount--;
                          }
                      }
                  }
                  

                  }

                  If it's not broken, fix it until it is

                  J Offline
                  J Offline
                  Jan Steyn
                  wrote on last edited by
                  #16

                  Sitting on the fence between C# and VB.NET, I can only say that this is one of the mistakes that are impossible to make in VB.NET!!! :laugh: :laugh: :laugh: ;P

                  1 Reply Last reply
                  0
                  • L Lost User

                    Chris Maunder wrote:

                    [beer] time.

                    Schmiddy of light?

                    Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #17

                    Shandy

                    L 1 Reply Last reply
                    0
                    • L Lost User

                      Shandy

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #18

                      _Josh_ wrote:

                      Shandy

                      He's not going to be able to only target me now, you'll have to be in his sights.

                      Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                      1 Reply Last reply
                      0
                      • K Kevin Marois

                        This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

                        private void DeleteSelectedRows()
                        {
                        if (accountsUltraGrid.Selected.Rows.Count > 0)
                        {
                        string message = "Are you sure you want to delete the selected accounts?";
                        if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
                        {
                        foreach (var gridRow in accountsUltraGrid.Selected.Rows)
                        {
                        Account account = gridRow.ListObject as Account;

                                    host.GetProxy().DeleteAccount(account);
                                    totalRowCount--;
                                }
                            }
                        }
                        

                        }

                        If it's not broken, fix it until it is

                        J Offline
                        J Offline
                        J4amieC
                        wrote on last edited by
                        #19

                        Im surprised nobody has pointed out that the method you want is ShowDialog not Show

                        OriginalGriffO 1 Reply Last reply
                        0
                        • J J4amieC

                          Im surprised nobody has pointed out that the method you want is ShowDialog not Show

                          OriginalGriffO Offline
                          OriginalGriffO Offline
                          OriginalGriff
                          wrote on last edited by
                          #20

                          That might be because there is no MessageBox.ShowDialog method... :-D

                          Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

                          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                          J 1 Reply Last reply
                          0
                          • K Kevin Marois

                            This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

                            private void DeleteSelectedRows()
                            {
                            if (accountsUltraGrid.Selected.Rows.Count > 0)
                            {
                            string message = "Are you sure you want to delete the selected accounts?";
                            if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
                            {
                            foreach (var gridRow in accountsUltraGrid.Selected.Rows)
                            {
                            Account account = gridRow.ListObject as Account;

                                        host.GetProxy().DeleteAccount(account);
                                        totalRowCount--;
                                    }
                                }
                            }
                            

                            }

                            If it's not broken, fix it until it is

                            OriginalGriffO Offline
                            OriginalGriffO Offline
                            OriginalGriff
                            wrote on last edited by
                            #21

                            You do get a warning however:

                            Warning 1 Possible mistaken empty statement

                            This is why I run with "Treat Warnings as Errors" set to "All" - it catches these, and won't let me run until I fix 'em. (It also means I can't get away with missing out the XML comments because "I'll come back to them later", because I never do...)

                            Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water

                            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                            1 Reply Last reply
                            0
                            • K Kevin Marois

                              This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

                              private void DeleteSelectedRows()
                              {
                              if (accountsUltraGrid.Selected.Rows.Count > 0)
                              {
                              string message = "Are you sure you want to delete the selected accounts?";
                              if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
                              {
                              foreach (var gridRow in accountsUltraGrid.Selected.Rows)
                              {
                              Account account = gridRow.ListObject as Account;

                                          host.GetProxy().DeleteAccount(account);
                                          totalRowCount--;
                                      }
                                  }
                              }
                              

                              }

                              If it's not broken, fix it until it is

                              R Offline
                              R Offline
                              Rahul Rajat Singh
                              wrote on last edited by
                              #22

                              I think the code is perfectly written. The developer must be a genius and realized why would i need a confirmation if the user has already choose to delete. So he placed an innocent looking message and a clever ; to achieve this. absolute genius I say. +5.

                              Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.

                              1 Reply Last reply
                              0
                              • K Kevin Marois

                                This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

                                private void DeleteSelectedRows()
                                {
                                if (accountsUltraGrid.Selected.Rows.Count > 0)
                                {
                                string message = "Are you sure you want to delete the selected accounts?";
                                if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
                                {
                                foreach (var gridRow in accountsUltraGrid.Selected.Rows)
                                {
                                Account account = gridRow.ListObject as Account;

                                            host.GetProxy().DeleteAccount(account);
                                            totalRowCount--;
                                        }
                                    }
                                }
                                

                                }

                                If it's not broken, fix it until it is

                                P Offline
                                P Offline
                                Pete OHanlon
                                wrote on last edited by
                                #23

                                As no one else has pointed it out, where were the unit tests? A comprehensive test would have picked this up long before.

                                *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                                "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                                CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                                L B 2 Replies Last reply
                                0
                                • K Kevin Marois

                                  This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

                                  private void DeleteSelectedRows()
                                  {
                                  if (accountsUltraGrid.Selected.Rows.Count > 0)
                                  {
                                  string message = "Are you sure you want to delete the selected accounts?";
                                  if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
                                  {
                                  foreach (var gridRow in accountsUltraGrid.Selected.Rows)
                                  {
                                  Account account = gridRow.ListObject as Account;

                                              host.GetProxy().DeleteAccount(account);
                                              totalRowCount--;
                                          }
                                      }
                                  }
                                  

                                  }

                                  If it's not broken, fix it until it is

                                  M Offline
                                  M Offline
                                  megaadam
                                  wrote on last edited by
                                  #24

                                  Your tagline alone deserves a 5.

                                  Life is too shor

                                  1 Reply Last reply
                                  0
                                  • P Pete OHanlon

                                    As no one else has pointed it out, where were the unit tests? A comprehensive test would have picked this up long before.

                                    *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                                    "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                                    CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                                    L Offline
                                    L Offline
                                    Lost User
                                    wrote on last edited by
                                    #25

                                    Pete O'Hanlon wrote:

                                    As no one else has pointed it out, where were the unit tests? A comprehensive test would have picked this up long before.

                                    Does scrum or agile have unit tests?

                                    Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                                    P 1 Reply Last reply
                                    0
                                    • K Kevin Marois

                                      This isn't a programming question. I wrote this, and just did a DOH!! Can you spot the bug? QA submitted a ticket say that when the Delete Account button was clicked, and the user click No when asked to confirm, it still deleted the row.

                                      private void DeleteSelectedRows()
                                      {
                                      if (accountsUltraGrid.Selected.Rows.Count > 0)
                                      {
                                      string message = "Are you sure you want to delete the selected accounts?";
                                      if (MessageBox.Show(message, "Delete Accounts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
                                      {
                                      foreach (var gridRow in accountsUltraGrid.Selected.Rows)
                                      {
                                      Account account = gridRow.ListObject as Account;

                                                  host.GetProxy().DeleteAccount(account);
                                                  totalRowCount--;
                                              }
                                          }
                                      }
                                      

                                      }

                                      If it's not broken, fix it until it is

                                      R Offline
                                      R Offline
                                      Rage
                                      wrote on last edited by
                                      #26

                                      So now you know why you should not ignore warnings in production code.

                                      ~RaGE();

                                      I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Do not feed the troll ! - Common proverb

                                      1 Reply Last reply
                                      0
                                      • P Pete OHanlon

                                        As no one else has pointed it out, where were the unit tests? A comprehensive test would have picked this up long before.

                                        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                                        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                                        CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                                        B Offline
                                        B Offline
                                        BobJanova
                                        wrote on last edited by
                                        #27

                                        Unit testing user interface is hard and generally missed out. Since the bug was actually in the line that checked the UI response I can see how this could easily slip through testing.

                                        P 1 Reply Last reply
                                        0
                                        • L Lost User

                                          Pete O'Hanlon wrote:

                                          As no one else has pointed it out, where were the unit tests? A comprehensive test would have picked this up long before.

                                          Does scrum or agile have unit tests?

                                          Michael Martin Australia "I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible." - Mr.Prakash One Fine Saturday. 24/04/2004

                                          P Offline
                                          P Offline
                                          Pete OHanlon
                                          wrote on last edited by
                                          #28

                                          Yes.

                                          *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

                                          "Mind bleach! Send me mind bleach!" - Nagy Vilmos

                                          CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups