Thursday, January 3, 2008

Asp.net Basics-2

Arrays
Dim a(2) As String
a(0) = "1"
a(1) = "2"
a(2) = "3"

Dim a2(2,2) As String
a(0,0) = "1"
a(1,0) = "2"
a(2,0) = "3"





Initialization

Dim s As String = "Hello World"
Dim i As Integer = 1
Dim a() As Double = { 3.00, 4.00, 5.00 }



If Statements

If Not (Request.QueryString = Nothing)
...
End If



Case Statements

Select Case FirstName
Case "John"
...
Case "Paul"
...
Case "Ringo"
...
Case Else
...
End Select




For Loops

Dim I As Integer
For I = 0 To 2
a(I) = "test"
Next


While Loops

Dim I As Integer
I = 0
Do While I < 3
Console.WriteLine(I.ToString())
I += 1
Loop


Exception Handling

Try
' Code that throws exceptions
Catch E As OverflowException
' Catch a specific exception
Catch E As Exception
' Catch the generic exceptions
Finally
' Execute some cleanup code
End Try

0 comments: