'Project: Ch08ShippingListsNEW 'Programmer: Joan Albright 'Date: March 2011 'Description: Uses a 2D table to lookup shipping costs using direct lookup method based on the Weight and Zone Public Class ShippingForm ' Declare module-level variables. Dim RateDecimal(,) As Decimal = {{1D, 1.5D, 1.65D, 1.85D}, _ {1.58D, 2D, 2.4D, 3.05D}, _ {1.71D, 2.52D, 3.1D, 4D}, _ {2.04D, 3.12D, 4D, 5.01D}, _ {2.52D, 3.75D, 5.1D, 7.25D}} Private Sub LookupButton_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles LookupButton.Click ' Look up the shipping rate. Dim WeightIndexInteger As Integer Dim ZoneIndexInteger As Integer WeightIndexInteger = WeightListBox.SelectedIndex ZoneIndexInteger = ZoneListBox.SelectedIndex If WeightIndexInteger <> -1 Then If ZoneIndexInteger <> -1 Then ChargesTextBox.Text = _ RateDecimal(WeightIndexInteger, ZoneIndexInteger).ToString("N") Else MessageBox.Show("Select the zone.", "Information Missing", _ MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If Else MessageBox.Show("Select the weight.", "Information Missing", _ MessageBoxButtons.OK, MessageBoxIcon.Exclamation) End If End Sub Private Sub ShippingForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub End Class