1
Reply

Form should not be shown after raising an error

Dorababu Meka

Dorababu Meka

Sep 4 2010 1:12 AM
12.1k
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)