DOH!!!
-
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
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 -
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
:doh: Been there, done that. :beer: time.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
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
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
-
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
-
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
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.
-
:doh: Been there, done that. :beer: time.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
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
-
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
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
-
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
without having looked at the previous answers I say just remove the ";" at the end of the if statement. subtle. ;)
-
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
-
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
-
_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
-
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
-
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
-
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
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
-
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
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.
-
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
-
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
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
-
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
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
-
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
-
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