furniture invoice that has 2 radio buttons and item in listbox to textbox

I have been working on this program for days and I can not figure out what I am doing wrong. I have most of the code done but I am getting error messages with the radio buttons. The new user radio button is supposed to take the data inserted in the textboxes and display it in the second listbox but it only does this with the first input. How can I fix this? The existing user radio button is supposed to allow me to select a line from the second listbox and then it should split the line and add the data to the three textboxes. I throws an exception error when I click the existing user radio button. How can I correct this error? This is the code I have so far. I am going to post the entire code just in case it is needed.

Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
'I am dimming my variables that I need
Dim name As String
Dim address As String
Dim city As String
Dim firstlast As String
Dim invoicenumber As String
Dim chairs As Double
Dim sofas As Double
'I am assigning value to my variables
name = txtName.Text
address = txtAddress.Text
city = txtCity.Text
chairs = CDbl(txtChairs.Text) * 350
sofas = CDbl(txtSofas.Text) * 925
'I am using if clauses to make sure the user puts values into the text boxes and if not then a message box will appear
If name = "" Then
MessageBox.Show("Please Enter Your Name.")
txtName.Focus()
End If
If address = "" Then
MessageBox.Show("Please Enter Your Address.")
txtAddress.Focus()
End If
If city = "" Then
MessageBox.Show("Please Enter Your City, State, and Zip in Correct Format.")
txtCity.Focus()
End If
If address.Contains(",") = False Then
MessageBox.Show("Please Enter In Correct Format: City, St., Zip.")
End If
'These are my functions that I made for the invoice number and name reverse
invoicenumber = GenerateinvoiceNumber(txtName.Text)
firstlast = RevName(name)
'I am adding all of the items to my listbox
lstResults.Items.Clear()
lstResults.Items.Add("INVOICE NUMBER: " & " " & invoicenumber.ToUpper)
lstResults.Items.Add(String.Empty)
lstResults.Items.Add("Name: " & " " & RevName(txtName.Text.ToUpper))
lstResults.Items.Add("Address: " & "" & address.ToUpper)
lstResults.Items.Add("City: " & " " & city.ToUpper)
lstResults.Items.Add(String.Empty)
lstResults.Items.Add("Number of Chairs: " & "" & txtChairs.Text)
lstResults.Items.Add("Number of Sofas: " & " " & txtSofas.Text)
lstResults.Items.Add(String.Empty)
lstResults.Items.Add("Cost: " & " " & FormatCurrency(chairs + sofas))
lstResults.Items.Add("Sales Tax:" & " " & FormatCurrency((chairs + sofas) * 0.05))
lstResults.Items.Add("--------------------------------------------")
lstResults.Items.Add("Total Cost: " & " " & FormatCurrency((chairs + sofas) * 1.05))
End Sub
'This is the function for the name reverse.
Function RevName(ByVal name As String) As String
Dim firstlast() As String
'This split is to take the part of the word after the comma
firstlast = Split(txtName.Text.ToUpper, ", ")
'This if clause is to make sure that the name is formatted correctly with a comma
If name.Contains(", ") = False Then
MessageBox.Show("Please Enter Your Name In Correct Format.")
End If
'This will show the function and the correct formatting in my list box
Return firstlast(1) & " " & firstlast(0)
End Function
'This is my function to create the invoice number
Function GenerateinvoiceNumber(ByVal s As String) As String
'Dimming the variables I need for my function
Dim initials() As String
Dim firstInitial, invoicenumber, city As String
'Assigning values to the variables
'I am using a split to get the letters from the last name
initials = s.Split(CChar(","))
'I am taking the letters that I need using a substring
firstInitial = initials(0).Trim.Substring(0, 2).ToUpper
city = txtCity.Text
'This is to get the value of the textbox city and the length of the input
Dim length = city.Length
'This is to get the first two letters of the name behind the comma and the city substring will extract the last four characters in the city textbox
invoicenumber = (firstInitial & city.Substring(length - 4, 4))
'This is to return the value of the function
Return invoicenumber
End Function
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'This is to clear the form and start over
txtName.Clear()
txtAddress.Clear()
txtCity.Clear()
txtChairs.Clear()
txtSofas.Clear()
lstResults.Items.Clear()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'This is to end the entire form
Me.Close()
End Sub

There is a convention in writing programming codification is Check the validation before assigning the values to the variables and force the user to input a value unless it is optional.
But,here you do that from reverse. First you have assigned the values to the variables then checked the validation.
I do here a function to check the validation. Remove the lines 19 to 33 and call the function before line no 11.

Private Function ValidatingText() As Boolean
If String.IsNullOrEmpty(txtName.Text) Then
MessageBox.Show("Please Enter Your Name.")
txtName.Focus()
Return False
End If
If String.IsNullOrEmpty(txtAddress.Text) Then
MessageBox.Show("Please Enter Your Address.")
txtAddress.Focus()
Return False
End If
If String.IsNullOrEmpty(txtCity.Text) Then
MessageBox.Show("Please Enter Your City, State, and Zip in Correct Format.")
txtCity.Focus()
Return False
End If
Return True
End Function

Put the following codes at the line no 11 to check the input validation.

Well, now this is time to go to my workig place. I will try to solve the problem in the evening.

This is most interesting that you have forced the user to seperate the every word of his name by a ",", like "FirstName","MiddleName","SurName".

Leave them free and split the text by a space.
Like this

Function RevName(ByVal name As String) As String
Dim firstlast() As String
Dim RevName as String=""
'This split is to take the part of the word after the comma
firstlast = Split(name.ToUpper, " ")
'Now join the name reversely
For i As Integer = Ubound(firstlast) To 0 Step -1
RevName &=firstlast(i).Trim & " "
Next
Return RevName.Trim
End Function

Thank You and the comma is required by the professor, I have done this now. I had changed a few things before you responded and this function works perfectly I really appreciate this. I still cant get the radio buttons to work. I cant select the line in the listbox and add the data to the textboxes.

'I am dimming my variables that I need
Dim name As String
Dim address As String
Dim city As String
Dim firstlast As String
Dim invoicenumber As String
Dim chairs As Double
Dim sofas As Double
If ValidatingText() = False Then
Exit Sub
End If
'I am assigning value to my variables
name = txtName.Text
address = txtAddress.Text
city = txtCity.Text
chairs = CDbl(txtChairs.Text) * 350
sofas = CDbl(txtSofas.Text) * 925
'I am using if clauses to make sure the user puts values into the text boxes and if not then a message box will appear
'These are my functions that I made for the invoice number and name reverse
invoicenumber = GenerateinvoiceNumber(txtName.Text)
firstlast = RevName(name)
'I am adding all of the items to my listbox
lstResults.Items.Clear()
lstResults.Items.Add("INVOICE NUMBER: " & " " & invoicenumber.ToUpper)
lstResults.Items.Add(String.Empty)
lstResults.Items.Add("Name: " & " " & RevName(txtName.Text.ToUpper))
lstResults.Items.Add("Address: " & "" & address.ToUpper)
lstResults.Items.Add("City: " & " " & city.ToUpper)
lstResults.Items.Add(String.Empty)
lstResults.Items.Add("Number of Chairs: " & "" & txtChairs.Text)
lstResults.Items.Add("Number of Sofas: " & " " & txtSofas.Text)
lstResults.Items.Add(String.Empty)
lstResults.Items.Add("Cost: " & " " & FormatCurrency(chairs + sofas))
lstResults.Items.Add("Sales Tax:" & " " & FormatCurrency((chairs + sofas) * 0.05))
lstResults.Items.Add("-------------------------------------------------------------")
lstResults.Items.Add("Total Cost: " & " " & FormatCurrency((chairs + sofas) * 1.05))
End Sub
'This is the function for the name reverse.
Function RevName(ByVal name As String) As String
Dim firstlast() As String
'This split is to take the part of the word after the comma
firstlast = Split(txtName.Text.ToUpper, ", ")
'This if clause is to make sure that the name is formatted correctly with a comma
If name.Contains(", ") = False Then
MessageBox.Show("Please Enter Your Name In Correct Format.")
End If
'This will show the function and the correct formatting in my list box
Return firstlast(1) & " " & firstlast(0)
End Function
'This is my function to create the invoice number
Function GenerateinvoiceNumber(ByVal s As String) As String
'Dimming the variables I need for my function
Dim initials() As String
Dim firstInitial, invoicenumber, city As String
'Assigning values to the variables
'I am using a split to get the letters from the last name
initials = s.Split(CChar(","))
'I am taking the letters that I need using a substring
firstInitial = initials(0).Trim.Substring(0, 2).ToUpper
city = txtCity.Text
'This is to get the value of the textbox city and the length of the input
Dim length = city.Length
'This is to get the first two letters of the name behind the comma and the city substring will extract the last four characters in the city textbox
invoicenumber = (firstInitial & city.Substring(length - 4, 4))
'This is to return the value of the function
Return invoicenumber
End Function
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'This is to clear the form and start over
txtName.Clear()
txtAddress.Clear()
txtCity.Clear()
txtChairs.Clear()
txtSofas.Clear()
lstResults.Items.Clear()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'This is to end the entire form
Me.Close()
End Sub
Private Sub rbtnNew_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnNew.CheckedChanged
ValidatingText()
If rbtnNew.Checked = Enabled Then
rbtnExisting.Checked = False
End If
If rbtnNew.Checked = True Then
lstCustomer.Items.Add(RevName(txtName.Text.ToUpper) & " , " & (txtAddress.Text.ToUpper) & " , " & (txtCity.Text.ToUpper))
End If
End Sub
Private Sub rbtnExisting_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnExisting.CheckedChanged
rbtnExisting.Checked = Enabled
txtName.Text = CStr(Enabled)
txtAddress.Text = CStr(Enabled)
txtCity.Text = CStr(Enabled)
Dim output() As String
Dim listselected As String
Dim name1, address2, city2 As String
listselected = CStr(lstCustomer.SelectedItem)
lstResults.Items.Clear()
txtName.Clear()
txtAddress.Clear()
txtCity.Clear()
txtChairs.Clear()
txtSofas.Clear()
'Assigning values to the variables
name1 = txtName.Text
address2 = txtAddress.Text
city2 = txtCity.Text
If rbtnExisting.Checked = True Then
'I am using a split to get the data from the listbox to split into the textboxes
output = listselected.Split(CChar(","))
'I am taking the data that I need using a substring and adding to the textboxes
txtName.Text = output(0).Trim.Substring(CInt(","))
txtAddress.Text = output(1).Trim.Substring(CInt(","))
txtCity.Text = output(2).Trim.Substring(CInt(","))
End If
End Sub
Private Function ValidatingText() As Boolean
If String.IsNullOrEmpty(txtName.Text) Then
MessageBox.Show("Please Enter Your Name.")
txtName.Focus()
Return False
End If
If String.IsNullOrEmpty(txtAddress.Text) Then
MessageBox.Show("Please Enter Your Address.")
txtAddress.Focus()
Return False
End If
If String.IsNullOrEmpty(txtCity.Text) Then
MessageBox.Show("Please Enter Your City, State, and Zip in Correct Format.")
txtCity.Focus()
Return False
End If
Return True
End Function

In your codification there are too many mistakes you did. You use CDbl() Fuunction to convert the value in txtChairs and txtSofas TextBoxes to Numeric.
But CDbl() never converts a String Type Value To a Double Type Numerical Value.
To covert from String To Numerical Value (It should convert to be Double or Integer Type) you would be used the Val() Function.
Like

There are a massive mistake in your codesIf rbtnExisting.Checked = True Then
'I am using a split to get the data from the listbox to split into the textboxes
output = listselected.Split(CChar(","))
'I am taking the data that I need using a substring and adding to the textboxes
txtName.Text = output(0).Trim.Substring(CInt(","))
txtAddress.Text = output(1).Trim.Substring(CInt(","))
txtCity.Text = output(2).Trim.Substring(CInt(","))
End If
Here you already split the string by a ',' i.e. output = listselected.Split(CChar(",")). So, why did you try to eleminate the ',' from the array element. i.e. txtName.Text = output(0).Trim.Substring(CInt(",")). There is no need to do that, you already eleminate the ',' when you split it on that character.
I do some modification in your codes after reading it. It should help you.

Public Class Form1
'I am dimming my variables that I need
Dim address As String
Dim city As String
Dim firstlast As String
Dim invoicenumber As String
Dim chairs As Double
Dim sofas As Double
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
If ValidatingText() = False Then
Exit Sub
End If
name = txtName.Text
address = txtAddress.Text
city = txtCity.Text
chairs = CDbl(Val(txtChairs.Text)) * 350
sofas = CDbl(Val(txtSofas.Text)) * 925
invoicenumber = GenerateinvoiceNumber(txtName.Text)
firstlast = RevName(name)
lstResults.Items.Clear()
lstResults.Items.Add("INVOICE NUMBER: " & " " & invoicenumber.ToUpper)
lstResults.Items.Add(String.Empty)
lstResults.Items.Add("Name: " & " " & RevName(txtName.Text.ToUpper))
lstResults.Items.Add("Address: " & "" & address.ToUpper)
lstResults.Items.Add("City: " & " " & city.ToUpper)
lstResults.Items.Add(String.Empty)
lstResults.Items.Add("Number of Chairs: " & "" & txtChairs.Text)
lstResults.Items.Add("Number of Sofas: " & " " & txtSofas.Text)
lstResults.Items.Add(String.Empty)
lstResults.Items.Add("Cost: " & " " & FormatCurrency(chairs + sofas))
lstResults.Items.Add("Sales Tax:" & " " & FormatCurrency((chairs + sofas) * 0.05))
lstResults.Items.Add("-------------------------------------------------------------")
lstResults.Items.Add("Total Cost: " & " " & FormatCurrency((chairs + sofas) * 1.05))
End Sub
'This is the function for the name reverse.
Function RevName(ByVal name As String) As String
Dim firstlast() As String
Dim RName As String = ""
'This split is to take the part of the word after the comma
firstlast = Split(name.ToUpper, ",")
'Now join the name reversely
For i As Integer = Ubound(firstlast) To 0 Step -1
RName &= firstlast(i).Trim
If i > 0 Then
RName &= " "
End If
Next
Return RName.Trim
End Function
'This is my function to create the invoice number
Private Function GenerateinvoiceNumber(ByVal s As String) As String
Dim initials() As String
Dim firstInitial, invoicenumber, city As String
initials = s.Split(CChar(","))
'I am taking the letters that I need using a substring
firstInitial = initials(0).Trim.Substring(0, 2).ToUpper
city = txtCity.Text
'This is to get the value of the textbox city and the length of the input
Dim length = city.Length
'This is to get the first two letters of the name behind the comma and the city substring will extract the last four characters in the city textbox
invoicenumber = (firstInitial & city.Substring(length - 4, 4))
'This is to return the value of the function
Return invoicenumber
End Function
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'This is to clear the form and start over
txtName.Clear()
txtAddress.Clear()
txtCity.Clear()
txtChairs.Clear()
txtSofas.Clear()
lstResults.Items.Clear()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'This is to end the entire form
Me.Close()
End Sub
Private Sub rbtnNew_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnNew.CheckedChanged
If rbtnNew.Checked Then
If Not ValidatingText() Then
rbtnNew.Checked = False
Exit Sub
End If
lstCustomer.Items.Add(RevName(txtName.Text.ToUpper) & " , " & (txtAddress.Text.ToUpper) & " , " & (txtCity.Text.ToUpper))
End If
End Sub
Private Sub rbtnExisting_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnExisting.CheckedChanged
Dim output() As String
Dim name() As String
Dim listselected As String
'If selection is 0 then exit from procedure
If lstCustomer.SelectedItems.Count = 0 Then Exit Sub
listselected = CStr(lstCustomer.SelectedItem)
'To Clear the TextBoxes call the Click event of the Button btnClear
btnClear.PerformClick()
If rbtnExisting.Checked Then
'split and store in an array
output = listselected.Split(CChar(","))
'adding to the textboxes
'Transferring the name as input format i.e. "First_Name, Middle_Name, Last_Name"
name = output(0).Trim.Split(CChar(" "))
For i As Integer = UBound(name) To 0 Step -1
txtName.Text &= name(i)
If i > 0 Then
txtName.Text &= ", "
End If
Next
txtAddress.Text = output(1)
'Transferring the city as input format i.e. "First_Name, Middle_Name, Last_Name"
For i As Integer = 2 To UBound(output)
txtCity.Text &= output(i)
If i < UBound(output) Then
txtCity.Text &= ", "
End If
Next
End If
End Sub
Private Function ValidatingText() As Boolean
'First Checking Name TextBox is Empty or not
If String.IsNullOrEmpty(txtName.Text) Then
'If Empty Prompt to the user
MessageBox.Show("Please Enter Your Name.")
txtName.Focus()
Return False
Else
'If Not Empty then Check for it contains ","
If Not txtName.Text.Contains(",") Then
'If Not Prompt to the User
Dim msgx As String = String.Format("Please, input your name in correct format.{0}Like : '{1}, {2}, {3}'", vbCrLf, "First_Name", "Middle_Name", "Last_Name")
MessageBox.Show(msgx)
txtName.Focus()
txtName.SelectAll()
Return False
End If
End If
'Ckeck for Address is empty or not
If String.IsNullOrEmpty(txtAddress.Text) Then
MessageBox.Show("Please Enter Your Address.")
txtAddress.Focus()
Return False
End If
'Check City is Empty or Not
If String.IsNullOrEmpty(txtCity.Text) Then
'If vbEmpty Prompt to the User
MessageBox.Show("Please Enter Your City, State, and Zip Code.")
txtCity.Focus()
Return False
Else
'Check it contains ","
If Not txtCity.Text.Contains(",") Then
'If Not Prompt to the User
Dim msgx As String = String.Format("Please, input your City, State, and Zip in correct format.{0}Like : '{1}, {2}, {3}'", vbCrLf, "City_Name", "State_Name", "Zip_Code")
MessageBox.Show(msgx)
txtCity.Focus()
txtCity.SelectAll()
Return False
End If
End If
'If all inputting is Ok
Return True
End Function
End Class