| | |
exception handling
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
is there a way to make this:
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!
VB.NET Syntax (Toggle Plain Text)
If dvdRadioButton.Checked = False And vhsRadioButton.Checked = False Then MessageBox.Show("Format not specified", "Unspecified format", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1) dvdRadioButton.Focus() End If If movieTitleTextBox.Text = "" Then MessageBox.Show("Movie title not entered", "Movie Title", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1) movieTitleTextBox.Focus() End If
I read something about add handles or something? Any help is appreciated!
It is practically impossible to teach good programming style to students that have had prior exposure to Basic; as potential programmers they are mentally mutilated beyond hope of regeneration.
-Edsger Dijkstra
-Edsger Dijkstra
•
•
Join Date: May 2007
Posts: 38
Reputation:
Solved Threads: 1
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
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
My current Project www.footystat.com
![]() |
Similar Threads
- Exception handling statement. (JavaScript / DHTML / AJAX)
- Exception Handling (C++)
- Borland C++ EDBEngineError exception (C++)
- Exception Handling (C++)
- purpose of exception handling 'finally' clause (Java)
- Arithmetic Exceptions and exception-handling statements (Java)
Other Threads in the VB.NET Forum
- Previous Thread: Tutorials, etc?
- Next Thread: project for online railway reservation in vb.net
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account arithmetic array basic bing button buttons center check code combobox component crystalreport data database datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog filter folder ftp generatetags google gridview hardcopy images input insert intel internet listview mobile monitor ms net networking objects output panel passingparameters peertopeervideostreaming picturebox picturebox1 port position print printing problem problemwithinstallation project read remove save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer timespan toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year






