Dorababu Meka

Dorababu Meka

  • 226
  • 8.3k
  • 1.7m

Form should not be shown after raising an error

Sep 4 2010 1:12 AM
Hi all i have written the following code

 
private void btnEntry_Click(object sender, EventArgs e)
{

if (cmbServiceClassCode.SelectedIndex == -1 || txtCompname.Text == string.Empty || txtCompidentification.Text == string.Empty
|| cmbStandardentryclasscode.SelectedIndex == -1 || txtOrgstatuscode.Text == string.Empty || txtODFIidentification.Text == string.Empty
|| txtBatchno.Text == string.Empty)
{
MessageBox.Show("Insufficient Data to Proceed"); if (Convert.ToBoolean(DialogResult.OK))
{
this.Show(); }
}

string s = cmbStandardentryclasscode.SelectedItem.ToString(); try
{

if (s == "CCD")
{
frmEntryDetails frmentry = new frmEntryDetails(s); frmentry.ShowDialog(this); }
else
{
frmEntryDetails frmentry = new frmEntryDetails(s); frmentry.ShowDialog(this); }
}


catch (Exception ex)
{

}

}

But if i select some value cmbStandardentryclasscode the error message is displayed but executing the remaining code. So can any one please help me.

Answers (1)