I am unable to get my program to display existing arrays
and then manipulate with add and remove commands. It seems
that I can add states and remove them but I cannot get my
states that I have loaded into form_load to appear as well.
HELP!!


Dim state(1 To 50) As String
Dim Amt As Integer
Option Explicit

Private Sub cmdDisplay_Click()
Call DisplayArray
End Sub

Private Sub cmdExit_Click()
End
End Sub

Private Sub cmdInsert_Click()
'insert state into ordered array and display states
Call AddState
Call DisplayArray
End Sub

Private Sub cmdRemove_Click()
'remove state from ordered array and display states
Call RemoveState
Call DisplayArray
End Sub


Private Sub Form_Load()
state(1) = "ALABAMA"
state(2) = "ARIZONA"
state(3) = "ILLINOIS"
state(4) = "INDIANA"
state(5) = "WYOMING"
End Sub

Private Sub DisplayArray()
Dim n As Integer
'display all states in array
picDisplay.Cls
For n = 1 To Amt
picDisplay.Print state(n)
Next n
End Sub

Private Sub AddState()
Dim newState As String, n As Integer, i As Integer
'Insert state into ordered array
If Amt = UBound(state) Then
MsgBox "All states have been entered"
Else
newState = UCase(txtState.Text)
state(Amt + 1) = newState
n = 1
Do While state(n) < newState
n = n + 1
Loop
If (UCase(newState) = state(n)) And (n <= Amt) Then
MsgBox "State is already listed in array"
Else
For i = Amt To n Step -1
state(i + 1) = state(i)
Next i
state(n) = newState
Amt = Amt + 1
End If
End If
txtState.Text = ""
txtState.SetFocus
End Sub

Private Sub RemoveState()
Dim remState As String, n As Integer, i As Integer
'remove a state from the array
remState = UCase(txtState.Text)
n = 1
Do While (n < Amt) And (remState > state(n))
n = n + 1
Loop
If (Amt = 0) Or (remState <> state(n)) Then
MsgBox "state is not found in array"
Else
Amt = Amt + 1
For i = n To Amt
state(i) = state(i + 1)
Next i
End If
txtState.Text = ""
End Sub