title: System.FormatException: Input string was not in a correct format
body: <p>So I'm try to make a small online store for my uni coursework and I've stumbled upon this error i don't understand. First off here is the code for my order page.</p>
  
  <pre><code>&lt;%@ Page Language="VB" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;script runat="server"&gt;
  
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)  
  
          Dim strSessionID As String
          Dim strItem As String
          Dim strQuantity As String
          strSessionID = Session.SessionID
          strItem = Session("Item")
          strQuantity = Session("Quantity")
          tbxItem.Text = strItem
          tbxQuantity.Text = strQuantity
  
      End sub
  
      Protected Sub btnAddOrder_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  
          Dim strItem As String
          Dim strQuantity As String
          Dim strFullName As String
          Dim strAddressLine As String
          Dim intPhoneNumber As Integer
          Dim intCardNumber As Integer
          Dim strNameOnCard As String
          Dim strExpirationDate As String
  
          strItem = tbxItem.Text
          strQuantity = tbxQuantity.Text
          strFullName = tbxFullName.Text
          strAddressLine = tbxAddressLine.Text
          intPhoneNumber = tbxPhoneNumber.Text
          intCardNumber = tbxCardNumber.Text
          strNameOnCard = tbxNameOnCard.Text
          strExpirationDate = tbxExpirationDate.Text
  
          Dim strDatabaseNameAndLocation As String
          strDatabaseNameAndLocation = Server.MapPath("pcland.mdb")
          Dim strSQLCommand As String
          strSQLCommand = "INSERT INTO orders(Item, Quantity, FullName, AddressLine, PhoneNumber, CardNumber, NameOnCard, ExpirationDate) " &amp; _
              "Values ('" &amp; strItem &amp; "','" &amp; strQuantity &amp; "','" &amp; strFullName &amp; "', '" &amp; strAddressLine &amp; "', '" &amp; intPhoneNumber &amp; "', '" &amp; intCardNumber &amp; "', '" &amp; strNameOnCard &amp; "', '" &amp; strExpirationDate &amp; "');"
          Dim objOleDbConnection As System.Data.OleDb.OleDbConnection
          objOleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data Source=" &amp; strDatabaseNameAndLocation)
          objOleDbConnection.Open()
          Dim objOleDbCommand As System.Data.OleDb.OleDbCommand
          objOleDbCommand = New System.Data.OleDb.OleDbCommand(strSQLCommand, objOleDbConnection)
          objOleDbCommand.ExecuteNonQuery()
          objOleDbConnection.Close()        
          strSQLCommand = "SELECT orders.* FROM orders ORDER BY orders.Price DESC;"
          objOleDbConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data Source=" &amp; strDatabaseNameAndLocation)       
          tbxItem.Text = ""
          tbxQuantity.Text = ""
          tbxFullName.Text = ""
          tbxAddressLine.Text = ""
          tbxPhoneNumber.Text = ""
          tbxCardNumber.Text = ""
          tbxNameOnCard.Text = ""
          tbxExpirationDate.Text = ""
  
          lblConfirmationMessage.Text = "Thank you for order."
  
      End Sub
  
  &lt;/script&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head runat="server"&gt;
          &lt;title&gt;PC land | Cart&lt;/title&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
          &lt;link href="#" rel="stylesheet" type="text/css" /&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id="webform" runat="server"&gt;
              &lt;div&gt;
                  &lt;table border="0"&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Item:&lt;/td&gt;
                      &lt;td&gt;&lt;asp:TextBox ID="tbxItem" ReadOnly="True" runat="server"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Quantity:&lt;/td&gt;
                      &lt;td&gt;&lt;asp:TextBox ID="tbxQuantity" ReadOnly="True" runat="server"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Full Name:&lt;/td&gt;
                      &lt;td&gt;&lt;asp:TextBox ID="tbxFullName" runat="server"&gt;&lt;/asp:TextBox&gt;
                      &lt;asp:RequiredFieldValidator ID="rfvFullName" runat="server" ControlToValidate="tbxFullName" 
                      Display="Dynamic"&gt;You must enter your full name&lt;/asp:RequiredFieldValidator&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Address Line:&lt;/td&gt;
                      &lt;td&gt;&lt;asp:TextBox ID="tbxAddressLine" TextMode="MultiLine" runat="server"&gt;&lt;/asp:TextBox&gt;
                      &lt;asp:RequiredFieldValidator ID="rfvAddressLine" runat="server" ControlToValidate="tbxAddressLine" 
                      Display="Dynamic"&gt;You must enter your address&lt;/asp:RequiredFieldValidator&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                      &lt;td&gt;Phone Number:&lt;/td&gt;
                      &lt;td&gt;&lt;asp:TextBox ID="tbxPhoneNumber" runat="server"&gt;&lt;/asp:TextBox&gt;
                      &lt;asp:RequiredFieldValidator ID="rfvPhoneNumber" runat="server" ControlToValidate="tbxPhoneNumber" 
                      Display="Dynamic"&gt;You must enter your phone number (No spaces or dashs)&lt;/asp:RequiredFieldValidator&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                      &lt;td&gt;Card Number:&lt;/td&gt;
                      &lt;td&gt;&lt;asp:TextBox ID="tbxCardNumber" runat="server"&gt;&lt;/asp:TextBox&gt;
                      &lt;asp:RequiredFieldValidator ID="rfvCardNumber" runat="server" ControlToValidate="tbxCardNumber" 
                      Display="Dynamic"&gt;You must enter the card number (No spaces or dashs)&lt;/asp:RequiredFieldValidator&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                      &lt;td&gt;Name On Card:&lt;/td&gt;
                      &lt;td&gt;&lt;asp:TextBox ID="tbxNameOnCard" runat="server"&gt;&lt;/asp:TextBox&gt;
                      &lt;asp:RequiredFieldValidator ID="rfvNameOnCard" runat="server" ControlToValidate="tbxNameOnCard" 
                      Display="Dynamic"&gt;You must enter the full name that is on the card &lt;/asp:RequiredFieldValidator&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                      &lt;td&gt;Expiration Date:&lt;/td&gt;
                      &lt;td&gt;&lt;asp:TextBox ID="tbxExpirationDate" runat="server"&gt;&lt;/asp:TextBox&gt;
                      &lt;asp:RequiredFieldValidator ID="rfvExpirationDate" runat="server" ControlToValidate="tbxExpirationDate" 
                      Display="Dynamic"&gt;You must enter the expiration date (Example format: 01/02/90)&lt;/asp:RequiredFieldValidator&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;&lt;asp:Button id="btnAddRecord" runat="server" onclick="btnAddOrder_Click" postbackurl="confirm.aspx" text="Submit" /&gt;&lt;/td&gt;&lt;br /&gt;
                  &lt;/tr&gt;
                  &lt;/table&gt;
                  &lt;asp:Label ID="lblConfirmationMessage" runat="server"&gt;&lt;/asp:Label&gt;&lt;br /&gt;
              &lt;/div&gt;
          &lt;/form&gt;
          &lt;div id="footer"&gt;Copyright &amp;copy; 2012 PC Land - All Rights Reserved&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Now here is the code for the confirm page which should display the choices that the user picked on the order page</p>
  
  <pre><code>&lt;%@ Page Language="VB" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;script runat="server"&gt;
  
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
  
          Dim tbxItem As TextBox
          Dim tbxQuantity As TextBox
          Dim tbxFullName As TextBox
          Dim tbxAddressLine As TextBox
          Dim tbxPhoneNumber As TextBox
          Dim tbxCardNumber As TextBox
          Dim tbxNameOnCard As TextBox
          Dim tbxExpirationDate As TextBox
  
          Dim strItem As String
          Dim strQuantity As String
          Dim strFullName As String
          Dim strAddressLine As String
          Dim intPhoneNumber As Integer
          Dim intCardNumber As Integer
          Dim strNameOnCard As String
          Dim strExpirationDate As String
  
  
          tbxItem = CType(Me.PreviousPage.FindControl("tbxItem"), TextBox)
          tbxQuantity = CType(Me.PreviousPage.FindControl("tbxQuantity"), TextBox)
          tbxFullName = CType(Me.PreviousPage.FindControl("tbxFullName"), TextBox)
          tbxAddressLine = CType(Me.PreviousPage.FindControl("tbxAddressLine"), TextBox)
          tbxPhoneNumber = CType(Me.PreviousPage.FindControl("tbxPhoneNumber"), TextBox)
          tbxCardNumber = CType(Me.PreviousPage.FindControl("tbxCardNumber"), TextBox)
          tbxNameOnCard = CType(Me.PreviousPage.FindControl("tbxNameOnCard"), TextBox)
          tbxExpirationDate = CType(Me.PreviousPage.FindControl("tbxExpirationDate"), TextBox)
  
          strItem = tbxItem.Text
          strQuantity = tbxQuantity.Text
          strFullName = tbxFullName.Text
          strAddressLine = tbxAddressLine.Text
          intPhoneNumber = tbxPhoneNumber.Text
          intCardNumber = tbxCardNumber.Text
          strNameOnCard = tbxNameOnCard.Text
          strExpirationDate = tbxExpirationDate.Text
  
          lblItem.Text = "You said your item was " &amp; strItem
          lblQuantity.Text = "You said your quantity was " &amp; strQuantity
          lblFullName.Text = "You said your full Name was " &amp; strFullName
          lblAddressLine.Text = "You said your Address was " &amp; strAddressLine
          lblPhoneNumber.Text = "You said your item was " &amp; intPhoneNumber
          lblCardNumber.Text = "You said your item was " &amp; intCardNumber
          lblNameOnCard.Text = "You said the name on your card was " &amp; strNameOnCard
          lblExpirationDate.Text = "You said the expiration date was " &amp; strExpirationDate
  
      End Sub
  
  &lt;/script&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head runat="server"&gt;
          &lt;title&gt;PC land | Cart&lt;/title&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
          &lt;link href="#" rel="stylesheet" type="text/css" /&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id="webform" runat="server"&gt;
              &lt;div&gt;
                  &lt;p&gt;&lt;asp:Label ID="lblItem" runat="server"&gt;&lt;/asp:Label&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;asp:Label ID="lblQuantity" runat="server"&gt;&lt;/asp:Label&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;asp:Label ID="lblFullName" runat="server"&gt;&lt;/asp:Label&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;asp:Label ID="lblAddressLine" runat="server"&gt;&lt;/asp:Label&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;asp:Label ID="lblPhoneNumber" runat="server"&gt;&lt;/asp:Label&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;asp:Label ID="lblCardNumber" runat="server"&gt;&lt;/asp:Label&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;asp:Label ID="lblNameOnCard" runat="server"&gt;&lt;/asp:Label&gt;&lt;/p&gt;
                  &lt;p&gt;&lt;asp:Label ID="lblExpirationDate" runat="server"&gt;&lt;/asp:Label&gt;&lt;/p&gt;
              &lt;/div&gt;
          &lt;/form&gt;
          &lt;div id="footer"&gt;Copyright &amp;copy; 2012 PC Land - All Rights Reserved&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>Server Error in '/' Application.
  Input string was not in a correct format.
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
  
  Exception Details: System.FormatException: Input string was not in a correct format.
  
  Source Error:
  
  Line 37:         strFullName = tbxFullName.Text
  Line 38:         strAddressLine = tbxAddressLine.Text
  Line 39:         intPhoneNumber = tbxPhoneNumber.Text
  Line 40:         intCardNumber = tbxCardNumber.Text
  Line 41:         strNameOnCard = tbxNameOnCard.Text
  
  
  Source File: D:\SOC Students Web Site\students\insc\insc209\project\confirm.aspx    Line: 39
  
  Stack Trace:
  
  [FormatException: Input string was not in a correct format.]
     Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat) +201
     Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +66
  
  [InvalidCastException: Conversion from string "" to type 'Integer' is not valid.]
     Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(String Value) +246
     ASP.students_insc_insc209_project_confirm_aspx.Page_Load(Object sender, EventArgs e) in D:\SOC Students Web Site\students\insc\insc209\project\confirm.aspx:39
     System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
     System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
     System.Web.UI.Control.OnLoad(EventArgs e) +99
     System.Web.UI.Control.LoadRecursive() +50
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
  </code></pre>
  
  <p>It's putting the information in the database but obviously I want to get rid of the error.</p>