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

    T Offline
    T Offline
    TheGreatAndPowerfulOz
    wrote on last edited by
    #2

    The ; at the end of MessabeBox.Show

    If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
    You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
    Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

    K 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

      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #3

      Kevin Marois wrote:

      the user click No when asked to confirm, it still deleted the row

      While setting up my Mac, it presents you with a EULA. The two buttons were:

      [Shut Down] [Agree]

      :laugh:

      Kevin Marois wrote:

      Can you spot the bug?

      Unfortunate placement of an extra semicolon. :)

      Thou mewling ill-breeding pignut!

      K 1 Reply Last reply
      0
      • T TheGreatAndPowerfulOz

        The ; at the end of MessabeBox.Show

        If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
        You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
        Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

        K Offline
        K Offline
        Kevin Marois
        wrote on last edited by
        #4

        Yup! I hate the fact that the compiler lets that through!! :mad::mad:

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

        T 1 Reply Last reply
        0
        • A AspDotNetDev

          Kevin Marois wrote:

          the user click No when asked to confirm, it still deleted the row

          While setting up my Mac, it presents you with a EULA. The two buttons were:

          [Shut Down] [Agree]

          :laugh:

          Kevin Marois wrote:

          Can you spot the bug?

          Unfortunate placement of an extra semicolon. :)

          Thou mewling ill-breeding pignut!

          K Offline
          K Offline
          Kevin Marois
          wrote on last edited by
          #5

          yaaa. Damn stupid compiler ;P

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

          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

            B Offline
            B Offline
            Brisingr Aerowing
            wrote on last edited by
            #6

            Ouch!

            I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. Stephen Hawking

            1 Reply Last reply
            0
            • K Kevin Marois

              Yup! I hate the fact that the compiler lets that through!! :mad::mad:

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

              T Offline
              T Offline
              TheGreatAndPowerfulOz
              wrote on last edited by
              #7

              yeah, a blank statement should not be allowed as the target of an if

              If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams
              You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun
              Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein

              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

                Mike HankeyM Offline
                Mike HankeyM Offline
                Mike Hankey
                wrote on last edited by
                #8

                The semi-colon at end of if, I consider that a tired mistake. You're coding like crazy and you're getting a lot done but getting tired and doh!

                VS2010/Atmel Studio 6.0 ToDo Manager Extension
                Version 3.0 now available. There is no place like 127.0.0.1

                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

                  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
                                          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