944,111 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 1032
  • VB.NET RSS
Sep 16th, 2007
0

exception handling

Expand Post »
is there a way to make this:
VB.NET Syntax (Toggle Plain Text)
  1. If dvdRadioButton.Checked = False And vhsRadioButton.Checked = False Then
  2. MessageBox.Show("Format not specified", "Unspecified format", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
  3. dvdRadioButton.Focus()
  4. End If
  5.  
  6. If movieTitleTextBox.Text = "" Then
  7. MessageBox.Show("Movie title not entered", "Movie Title", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
  8. movieTitleTextBox.Focus()
  9. End If
throw a single error message instead of two, one right after the other (without using the if construct)?

I read something about add handles or something? Any help is appreciated!
Similar Threads
Reputation Points: 817
Solved Threads: 32
Nearly a Posting Virtuoso
Duki is offline Offline
1,474 posts
since Jun 2006
Sep 17th, 2007
0

Re: exception handling

You could have a boolean inside the first If (boolFormat) which is set to true if the radio buttons are not checked,
and then inside the second If another boolean (boolMovieTitle) which is set to true if the movieTitleBox is empty.

Then you put other Ifs to check which of the booleans are set to true and display an individual error or both errors in the same box

e.g
If(boolFormat==true && boolMovietitle==true)
{
//display a compined error msg box
}
elseif (boolFormat==true &&boolMovieTitle==false)
{
//display Format error msg only
}
elseif (booolMovieTitle == true && boolFormat==false)
{
//display Title error msg only
}

Some of the syntax might be wrong, its been a while
Reputation Points: 22
Solved Threads: 1
Light Poster
matale is offline Offline
38 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Tutorials, etc?
Next Thread in VB.NET Forum Timeline: project for online railway reservation in vb.net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC