assignment 4:
due next monday, Oct 11
assignment 5:
due wednesday, Oct 13
String data type
collection of character
4 is an integer literal
"today" is a string literal
today in the example is a string variable
Primitive types vs Reference types
A Double, Integer, Boolean are primitive types
A String is a reference type, starts with Nothing (equivalent to NULL). when assign a string value to it, it points to that value on the heap.
If it is nothing and you try to use it, you will get a NullReferenceException
"" is the empty string. it is not Nothing
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim today As String
today = ""
With lstOutput.Items
.Clear()
.Add(today.Length)
.Add("today")
.Add(today)
End With
End Sub
If today IsNot Nothing Then
End If
What is an exception? Why should I use it?
instead of:
step 1
check for errors and fix
step 2
check for errors and fix
step 3
check for errors and fix
step 4
check for errors and fix
Try
step 1
step 2
step 3
step 4
Catch ex As Exception
attempt to fix the problem
End Try
No comments:
Post a Comment