I just need someone to review my VB code
This is the assignment:
Write a VB program that uses an Array of Strings to store state names as read in from the text file StatesBySize.txt. I will make this file available for your use on our course Sakai web page (Under Resources / Assignments folder). My suggestion: On your C-Drive create a folder called VB2012 (its full name would be C:VB2012â€. We will put all data files used for this course into that folder. If you do this then the call to ReadAllLines will refer to “C:VB2012StatesBySize.txtâ€
This is my code:
Public Class Form1
Private Property From As Object
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim States() As String = IO.File.ReadAllLines(“C:VB2012StatesBySize.txt”)
For i As Integer = 0 To States.Count – 1
lstbx1.Items.Add(States(i))
Next
End Sub
Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
Dim txtbx1 As Integer
Dim txtbx2 As Integer
Dim states() As String = IO.File.ReadAllLines(“C:VB2012StatesBySize.txt”)
If Not Integer.TryParse(From.text, txtbx1) Or txtbx1 < 0 Or txtbx1 > 50 Then
MessageBox.Show(“Please Input Valid Number For From:”, “Error (Shelina Lewis”)
Return
End If
lstbx1.Items.Clear()
For i As Integer = txtbx1 – 1 To txtbx2 – 1
lstbx1.Items.Add(states(i))
Next
End Sub
End Class