IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesVB.NetStatements  Print This     

Cross Ref > Statements

By Mike Prestwood

VB.Net versus ASP Classic: A side by side comparison between VB.Net and ASP Classic.

 
Statements
 

Common statements such as if statements, loops, etc.

Exception Trapping

[Other Languages] 

Languages Focus

A common usage of exception handling is to obtain and use resources in a "try-it" block, deal with any exceptions in an "exceptions" block, and release the resources in some kind of "final" block which executes whether or not any exceptions are trapped.

VB.Net:   Try...Catch...Finally

VB.Net uses a try...catch...finally statement to trap for errors.

Try
Catch
Finally
End Try
Syntax Example:
Try
Dim y As Integer = 0
y = 1 / y
Catch
MessageBox.Show("you cannot divide by zero")

End Try
ASP Classic:   On Error
Syntax Example:
On Error Resume Next
Response.Write FormatDateTime(f_CurrentActualDate, vbShortDate)
  
  If ErrNumber <> 0 Then
Break(f_CurrentActualDate)
End If
On Error Goto 0




If Statement

[Other Languages] 
VB.Net:   If..ElseIf..Else..End If

Same as VB classic.

Syntax Example:  
If x Then
MessageBox.Show("hello")
ElseIf Not x Then
MessageBox.Show("goodbye")
Else
MessageBox.Show("what?")
End If
ASP Classic:   If..ElseIf..Else..End If

The End If is optional if you put your code on a single line.

Syntax Example:
//Single line example.
If X = True Then Response.Write "hello" 
  
//Complete example.
If X = True Then
  '>>>do something.
ElseIf Y = "ABC" Then
  '>>>do something.
Else
  '>>>do something.
End If




Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]