title: State Abbreviation Codes in Visual Basic 2010 Express
body: <p>Am really glad i get someone to help with this , but the problem is am not really good on vb as am very new to it , can anyone please arrange it for me as it need to be then i will see what i can do with it . Then i will be able to start the project</p>
  
  <p>Question is to change states name to 2 Letter and calculate tax rate for them as well.
  California retail customers (State code = “CA”) are charged a sales tax on purchases – the California tax rate is 10%. Retail customers from New York (state code = “NY”) and Florida (state code = “FL”) are also taxed at a 5% tax rate.</p>
  
  <p>Below is the code i have so far </p>
  
  <pre><code>Public Class Form1
  
  Public Class State
    Public Sub New(ByVal name As String, ByVal abbr As String, ByVal taxPercent As Decimal)
      Me.Name = name
      Me.Abbreviation = abbr
      Me.TaxPercent = taxPercent
    End Sub
  
    Public Property Name As String
    Public Property Abbreviation As String
    Public Property TaxPercent As Decimal
  End Class
  
  Const U_P_S_DECIMAL As Decimal = 7D
  
  Const SALES_TAX_RATE_SINGLE As Single = 0.1 '10 Percent Rate
  
  'declare module-level variables
  Private TotalQuantityInteger As Integer
  Private TotalSalesDecimal As Decimal
  
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  
  Try
      '5 percent salses tex rate
      Const SALES_TEX_RATE_SINGLE As Single = 0.05 '5 percent rate
  
  
      Dim states As New List(Of State)
      states.Add(New State("California", "CA", 10))
      states.Add(New State("New York", "NY", 5))
      states.Add(New State("Florida", "FL", 5))
  
      For Each state As State In states
          Console.WriteLine("State: {0} Abbrevation: {1} Tax: {2}%",
                            state.Name, state.Abbreviation, state.TaxPercent)
      Next
  
      'Declare variables
      Dim SubDecimal, SalesTaxDecimal, TotalDueDecimal, TotalCostDecimal, ShippingCostDecimal As Decimal
      'Declare variables and convert value from textbox controls to memory
      Dim PriceDecimal As Decimal = Decimal.Parse(PriceTextBox.Text, Globalization.NumberStyles.Currency)
      Dim QuantityInteger As Integer = Integer.Parse(QuantityTextBox.Text, Globalization.NumberStyles.Number)
  
      'Process - Compute values
      'Subtotal = price times the quantity of books
      TotalCostDecimal = PriceDecimal * QuantityInteger
  
      'Sales tex = sales tax rate times the subtotal minus discount amount
      SalesTaxDecimal = Decimal.Round(Convert.ToDecimal(TotalCostDecimal * SALES_TEX_RATE_SINGLE), 2)
  
      SubDecimal = SalesTaxDecimal + ShippingCostDecimal
  
      'Total due is the subtotal minus discount amount plus sales tex
      TotalDueDecimal = TotalCostDecimal + SubDecimal
  
      If UPSRadioButton.Checked Then 'compute the shipping cost
          ShippingCostDecimal = U_P_S_DECIMAL * QuantityInteger
      End If
  
  
      'Output - display output formatted as currency
      SubtotalTextBox.Text = TotalCostDecimal.ToString("C")
      TotalDueTextBox.Text = TotalDueDecimal.ToString("C")
      salestaxTextBox.Text = SalesTaxDecimal.ToString("N")
      ShippingCostTextBox.Text = ShippingCostDecimal.ToString("N")
  
      'Accumulate total sales and total books sold
      TotalQuantityInteger += QuantityInteger
      TotalSalesDecimal += TotalDueDecimal
  Catch ex As Exception
  
  End Try
  End Sub
  </code></pre>
  
  <p>I have input the code i got on here but i dont know what to do to collect the data from textbox when the state is entered so that tax can be added to it . Any help will be appreciated. Am new to VB so i dont really know how everything works </p>