I am working on an assignment where I have to enter data as such:
First Name Last Name
Street Address
City, State Zip
Home Phone
Work Phone
...In a single text box, so I switched to a multiline text box.
I want to break the string into lines, error check the lines, and then cast each individual item into a field variable.
Here is my current code: (with lots of errors)
Any suggestions?Code:Option Explicit On Option Strict On 'Acme Info Public Class Form1 Private Sub btnConc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConc.Click Dim strInfo As String = txtInfo.Text Dim strLine1 As String Dim strLine2 As String Dim strLine3 As String Dim strLine4 As String Dim strLine5 As String Dim strFName As String Dim strLName As String Dim strAddress As String Dim strCity As String Dim strState As String Dim strZip As String Dim strHPhone As String Dim strWPhone As String strLine1 = strInfo.Substring(0, vbNewLine) strInfo = strInfo.Remove(0, vbNewLine) strLine2 = strInfo.Substring(0, vbNewLine) strInfo = strInfo.Remove(0, vbNewLine) strLine3 = strInfo.Substring(0, vbNewLine) strInfo = strInfo.Remove(0, vbNewLine) strLine4 = strInfo.Substring(0, vbNewLine) strInfo = strInfo.Remove(0, vbNewLine) strLine5 = strInfo.Substring(0, vbNewLine) strInfo = strInfo.Remove(0, vbNewLine) End Sub End Class




Reply With Quote