Please, I get some errors, please help, here is my code:
CODE
Public Class Form1
Dim states(49) As String
Dim tail As Integer = 0
Dim temp As String
Private Sub btnInsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsert.Click
states(tail) = txtBox.Text
tail = tail + 1
For passNum As Integer = 1 To (tail - 1)
For i As Integer = 1 To (tail - passNum)
If (states(i - 1) > states(i)) Then
temp = states(i - 1)
states(i - 1) = states(i)
states(i) = temp
End If
Next
Next
End Sub
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
End Sub
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
If states(0) <> "" Then
For i As Integer = 0 To tail
lstOutput.Items.Add(states(i))
Next
Else
MessageBox.Show("You have not entered any states yet.")
End If
End Sub
End Class
This is my error: System.Argument.Null.Exception for the line "lstOutput.Items.Add(states(i))"
PLease assist me