I'm working on a homework in which i need to create a Pizza order form. I've created the form along with the code but when i debug it, it gives me error. Errors below:(i've attached my code)

C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(113) : error BC30451: Name 'txtSurname' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(118) : error BC30451: Name 'txtSurname' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(119) : error BC30451: Name 'txtForename' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(120) : error BC30451: Name 'txtAddress' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(121) : error BC30451: Name 'txtAddress02' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(122) : error BC30451: Name 'txtTown' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(123) : error BC30451: Name 'txtPostcode' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(131) : error BC30451: Name 'txtSurname' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(134) : error BC30451: Name 'txtAddress' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(137) : error BC30451: Name 'txtPostcode' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(151) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(152) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(154) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(156) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(158) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(187) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(189) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(189) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(257) : warning BC42105: Function 'addDrinks' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(272) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(274) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(275) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(276) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(276) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(277) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(277) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(282) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(283) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(284) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(285) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(289) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(291) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(292) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(293) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(293) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(294) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(294) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(299) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(300) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(301) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(302) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(363) : error BC30451: Name 'txtSurname' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(364) : error BC30451: Name 'txtForename' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(365) : error BC30451: Name 'txtAddress' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(366) : error BC30451: Name 'txtAddress02' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(367) : error BC30451: Name 'txtTown' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(368) : error BC30451: Name 'txtPostcode' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(385) : error BC30451: Name 'txtSurname' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(386) : error BC30451: Name 'txtForename' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(387) : error BC30451: Name 'txtAddress' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(388) : error BC30451: Name 'txtAddress02' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(389) : error BC30451: Name 'txtTown' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(390) : error BC30451: Name 'txtPostcode' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(396) : error BC30451: Name 'txtSurname' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(397) : error BC30451: Name 'txtForename' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(398) : error BC30451: Name 'txtAddress' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(399) : error BC30451: Name 'txtAddress02' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(400) : error BC30451: Name 'txtTown' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(401) : error BC30451: Name 'txtPostcode' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(414) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(415) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(416) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(418) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(419) : error BC30451: Name 'i' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(451) : error BC30451: Name 'txtSurname' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(452) : error BC30451: Name 'txtForename' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(452) : error BC30451: Name 'txtAddress' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(453) : error BC30451: Name 'txtAddress02' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(453) : error BC30451: Name 'txtTown' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(454) : error BC30451: Name 'txtPostcode' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(500) : error BC30451: Name 'txtForename' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(500) : error BC30451: Name 'txtSurname' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(502) : error BC30451: Name 'txtAddress' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(505) : error BC30451: Name 'txtAddress02' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(506) : error BC30451: Name 'txtAddress02' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(510) : error BC30451: Name 'txtTown' is not declared.
C:\Users\Vasquez\Documents\Visual Studio 2005\Projects\Pizza Order\Pizza Order\Form1.vb(510) : error BC30451: Name 'txtPostcode' is not declared.

Attachments
Public Class frmPizzaDelivery
    'Declare database object variables
    Dim con As New OleDb.OleDbConnection
    Dim ds As New DataSet
    Dim da As OleDb.OleDbDataAdapter
    Dim sql As String
    Dim cmd As OleDb.OleDbCommand

    'Declare control arrays
    Dim RadioArrayTopping(0 To 2) As RadioButton
    Dim RadioArrayBase(0 To 2) As RadioButton
    Dim CheckArrayExtras(0 To 3) As CheckBox

    'Declare module variables
    Dim Topping() As String = {"Margherita", "Four Seasons", "Meat Feast"}
    Dim Base() As String = {"9""", "12""", "14"""}
    Dim Extras() As String = {"Mushrooms", "Green Peppers", "Anchovies", "Cheese"}
    Dim Drinks() As String = {"Cola", "Lemonade", "Orange", "Mineral Water"}
    Dim PizzaPrice(,) As Single = {{3.0, 4.0, 5.5}, {3.5, 4.5, 6.0}, {4.0, 5.0, 6.5}}
    Dim ExtraPrice() As Single = {0.5, 0.4, 0.6, 0.5}
    Dim DrinkPrice() As Single = {1.0, 1.0, 1.0, 0.9}
    Dim itemNo As Integer = -1
    Dim strOrder01 As String = ""
    Dim strOrder02 As String = ""
    Dim strDrinks As String = ""
    Dim pizzaVal, drinkVal, orderVal, delivery, total As Single

    'Structure to hold options for each pizza ordered
    Structure pizzaStruct
        Dim Topp As Integer
        Dim Base As Integer
        Dim Ex00 As Boolean
        Dim Ex01 As Boolean
        Dim Ex02 As Boolean
        Dim Ex03 As Boolean
    End Structure

    'Structure to hold drink selection
    Structure drinkStruct
        Dim Drink00 As Integer
        Dim Drink01 As Integer
        Dim Drink02 As Integer
        Dim Drink03 As Integer
    End Structure

    'Declare module structure variables
    Dim pizzaArray(-1) As pizzaStruct
    Dim drinkSelection As drinkStruct


    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Set up control arrays
        RadioArrayTopping(0) = radTop00
        RadioArrayTopping(1) = radTop01
        RadioArrayTopping(2) = radTop02
        RadioArrayBase(0) = radBas00
        RadioArrayBase(1) = radBas01
        RadioArrayBase(2) = radBas02
        CheckArrayExtras(0) = chkExt00
        CheckArrayExtras(1) = chkExt01
        CheckArrayExtras(2) = chkExt02
        CheckArrayExtras(3) = chkExt03
        'Initialise order
        clearOrder()
    End Sub

    Function checkTelNum() As Boolean
        'Make sure telephone number is valid
        Dim strAllowedChars As String = "0123456789()-+ "
        If Len(txtTel.Text) < 5 Then
            Return False
        Else
            For i = 0 To Len(txtTel.Text) - 1
                If InStr(1, strAllowedChars, txtTel.Text(i)) = 0 Then
                    Return False
                End If
            Next
            Return True
        End If
    End Function

    Private Sub cmdContinue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdContinue.Click
        'Check for valid telephone number before proceeding
        If checkTelNum() = False Then
            MsgBox("You have not entered a valid telephone number.")
            txtTel.Focus()
            Exit Sub
        End If
        'If telephone number is valid, disable telephone number input
        'and enable main form functionality
        cmdContinue.Enabled = False
        txtTel.Enabled = False
        pnlLeft.Enabled = True
        pnlRight.Enabled = True
        enableCustomerInput()
        'Open database and check for existing customer using telephone number
        con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=PizzaDelivery.accdb;"
        con.ConnectionString &= " Persist Security Info=False;"
        con.Open()
        sql = "SELECT * FROM Customer WHERE TelephoneNo = '" & txtTel.Text & "'"
        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(ds, "CustInfo")
        con.Close()
        If ds.Tables("CustInfo").Rows.Count = 0 Then
            'If customer telephone number not found, inform user
            'and move focus to customer surname input box
            MsgBox("Number not found in database.")
            cmdSave.Enabled = True
            txtSurname.Focus()
            Exit Sub
        Else
            'Otherwise add customer details to form
            txtTel.Text = ds.Tables("CustInfo").Rows(0).Item(0)
            txtSurname.Text = ds.Tables("CustInfo").Rows(0).Item(1)
            txtForename.Text = ds.Tables("CustInfo").Rows(0).Item(2)
            txtAddress.Text = ds.Tables("CustInfo").Rows(0).Item(3)
            txtAddress02.Text = ds.Tables("CustInfo").Rows(0).Item(4)
            txtTown.Text = ds.Tables("CustInfo").Rows(0).Item(5)
            txtPostcode.Text = ds.Tables("CustInfo").Rows(0).Item(6)
            'Protect customer details from changes
            disableCustomerInput()
        End If
    End Sub

    Function checkCustomer() As Boolean
        'Make sure customer details are complete
        If txtSurname.Text = "" Then
            MsgBox("Please enter the customer's surname.")
            Return False
        ElseIf txtAddress.Text = "" Then
            MsgBox("Please enter the customer's address.")
            Return False
        ElseIf txtPostcode.Text = "" Then
            MsgBox("Please enter the customer's postcode.")
            Return False
        Else
            Return True
        End If
    End Function

    Function addItem() As Boolean
        'Declare local variables
        Dim toppingSelected As Boolean = False
        Dim baseSelected As Boolean = False
        Dim top, bas As Integer
        'Check that a base and a topping are selected and get choices
        For i = 0 To 2
            If RadioArrayTopping(i).Checked = True Then
                toppingSelected = True
                top = i
            End If
            If RadioArrayBase(i).Checked = True Then
                baseSelected = True
                bas = i
            End If
        Next
        'If either base or topping not selected, prompt user
        If toppingSelected = False Then
            MsgBox("You have not selected a topping.")
            Return False
        End If
        If baseSelected = False Then
            MsgBox("You have not selected a base.")
            Return False
        Else
            'Increment item number
            itemNo += 1
            'If this is first pizza item enable drinks panel
            If itemNo = 0 Then pnlDrinks.Enabled = True
            'Increase the size of the pizza item array dynamically
            ReDim Preserve pizzaArray(itemNo)
            'Save user choices
            pizzaArray(itemNo).Topp = top
            pizzaArray(itemNo).Base = bas
            pizzaArray(itemNo).Ex00 = CheckArrayExtras(0).Checked
            pizzaArray(itemNo).Ex01 = CheckArrayExtras(1).Checked
            pizzaArray(itemNo).Ex02 = CheckArrayExtras(2).Checked
            pizzaArray(itemNo).Ex03 = CheckArrayExtras(3).Checked
        End If

        pizzaVal = 0 'Reset pizza item value

        For i = 0 To itemNo
            'Calculate total value of pizzas currently selected
            pizzaVal += PizzaPrice(pizzaArray(i).Topp, pizzaArray(i).Base)
            If pizzaArray(itemNo).Ex00 = True Then pizzaVal += ExtraPrice(0)
            If pizzaArray(itemNo).Ex01 = True Then pizzaVal += ExtraPrice(1)
            If pizzaArray(itemNo).Ex02 = True Then pizzaVal += ExtraPrice(2)
            If pizzaArray(itemNo).Ex03 = True Then pizzaVal += ExtraPrice(3)
        Next

        orderVal = pizzaVal + drinkVal 'Calculate order value

        If orderVal >= 10.0 Then
            'If order value is 10.00 or more delivery is free
            delivery = 0.0
        Else
            'If order value is less than 10.00 delivery is 2.00
            delivery = 2.0
        End If

        total = orderVal + delivery 'Calculate total to pay

        'Update order display
        txtOrder.Text = strOrder01
        lblOrderValue.Text = Format(orderVal, "currency")
        lblDeliveryCharge.Text = Format(delivery, "currency")
        lblOrderTotal.Text = Format(total, "currency")
        clearItem() 'clear pizza selection ready for next selection
        If itemNo > 14 Then
            'Number of items per order is limited to 15 - disable input of further items
            MsgBox("You have reached the maximum number of items for a single order.")
            cmdAddItem.Enabled = False
            pnlTopping.Enabled = False
            pnlBase.Enabled = False
            pnlExtras.Enabled = False
        End If
        Return True 'Item was added to order
    End Function

    Function addDrinks()
        'Get quantities of each drink selected
        drinkSelection.Drink00 = nudDrk00.Value
        drinkSelection.Drink01 = nudDrk01.Value
        drinkSelection.Drink02 = nudDrk02.Value
        drinkSelection.Drink03 = nudDrk03.Value

        drinkVal = 0 'Initialise value of drinks to zero

        'Calculate total value of drinks selected
        drinkVal += DrinkPrice(0) * drinkSelection.Drink00
        drinkVal += DrinkPrice(1) * drinkSelection.Drink01
        drinkVal += DrinkPrice(2) * drinkSelection.Drink02
        drinkVal += DrinkPrice(3) * drinkSelection.Drink03

        orderVal = pizzaVal + drinkVal 'calculate order value

        'Determine whether delivery charge should be applied
        If orderVal >= 10.0 Then
            delivery = 0.0
        Else
            delivery = 2.0
        End If

        total = orderVal + delivery 'calculate total to pay

        'Update order details and clear current pizza item
        txtOrder.Text = strOrder01
        lblOrderValue.Text = Format(orderVal, "currency")
        lblDeliveryCharge.Text = Format(delivery, "currency")
        lblOrderTotal.Text = Format(total, "currency")
        clearItem()
    End Function

    Sub writeOrder()
        'Construct order string - if order has more than 7 items not including drinks,
        'create a second order string to enable printing of delivery note on two pages
        Dim limit As Integer

Read the error message. You have to declare the variables and objects with types. Without seeing the form (and properties) I can only assume you created text boxes but left them with the default names (like TextBox1) instead of renaming them (like txtTown). Also, for loop variables you can declare them as

Dim i As Integer

For i = 0 to limit

or, more concisely

For i As Integer = 0 to limit
This article has been dead for over six months. Start a new discussion instead.