Get to specific Exception

  • Thread starter Thread starter Curious
  • Start date Start date
C

Curious

Hi,

I have the following code:

try
{

if (isBadData == true)
{
// Throw exception to get to Exception 1
}
else
{

DistributionRow lRow =
this.Connection.ExtractData( DistributionID );

textMessage.Text = "Good data";

this.PlaySound(this.MainForm.GoodData);
}
}
catch (Exception) // Exception 1
{
textMessage.Text = "Bad data";
this.PlaySound(this.MainForm.BadData);
}


When isBadData == true, I'll need to get to "Exception 1" to output
"Bad data", etc. Anyone can advise me on how to throw the exception
inside the if (isBadData == true) block?

Thanks!
 
Back
Top