Help with Visual Basic programming needed.

nns9916
codingforhomework.docx

Option Strict On

Public Class Form1

    Const basepay As Integer = 900

    Private Sub CalculatorButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculatorButton.Click

        Dim Input_Amount, commssion, grosspay, Deductions, netpay, hoursing, foodandclothing, Entertainment, Miscellaneous As Double

        Dim namelength As Integer

        namelength = NameTextBox.Text.Length

      

        Try

            Input_Amount = Decimal.Parse(

SalesamoutTextBox.Text)

            If Input_Amount < 0 Or namelength <= 0 Then

                MessageBox.Show("Put your name,or your sales amount cannot be nagetive")

            Else

                commssion = Input_Amount * 0.06

                grosspay = basepay + commssion

                Deductions = grosspay * 0.18

                netpay = grosspay - Deductions

                hoursing = netpay * 0.3

                foodandclothing = netpay * 0.15

                Entertainment = netpay * 0.5

                Miscellaneous = netpay * 0.5

                BasepayLabel.Text = basepay.ToString("C")

                CommissionLabel.Text = commssion.ToString("C")

                GrossLabel.Text = grosspay.ToString("C")

                DeductionsLabel.Text = Deductions.ToString("C")

                NetpayLabel.Text = netpay.ToString("C")

                HosingLabel.Text = hoursing.ToString("C")

                FoodAndClothingLabel.Text = foodandclothing.ToString("C")

                EnterainmentLabel.Text = Entertainment.ToString("C")

                MiscellaneousLabel.Text = Miscellaneous.ToString("C")

            End If

        Catch ex As FormatException

            MessageBox.Show("Please put the number of your amount sales")

            With SalesamoutTextBox

                .SelectAll()

                .Clear()

                .Focus()

            End With

        End Try

    End Sub

 

    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click

        BasepayLabel.Text = ""

        CommissionLabel.Text = ""

        GrossLabel.Text = ""

        DeductionsLabel.Text = ""

        NetpayLabel.Text = ""

        HosingLabel.Text = ""

        FoodAndClothingLabel.Text = ""

        EnterainmentLabel.Text = ""

        MiscellaneousLabel.Text = ""

        With NameTextBox

            .SelectAll()

            .Clear()

            .Focus()

        End With

        SalesamoutTextBox.Text = ""

    End Sub

    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click

        Me.Close()

    End Sub

  

End Class

'Project:flag

'programmer: Asatryan,Nairi

'Date: Mar 29 2013

'Description: Change the flags when you select different country RadioButtions. Also clude hide or show CheckButtons,and use tooplips to make a liitle be describution about each button.

Public Class MainForm

    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click

        'To make print ablity

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click

        'To make quit ablity

        Me.Close()

    End Sub

    Private Sub UnitedStatesRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnitedStatesRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.UnitedStates

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Football and Baseball"

    End Sub

    Private Sub JapanRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JapanRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.japan

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Terrible neighbor for Eastern Asia"

    End Sub

    Private Sub CanadaRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CanadaRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.canada

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Maple leaf"

    End Sub

    Private Sub MexicoRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MexicoRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.mexico

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Soccer,Soccer"

    End Sub

    Private Sub TitleCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TitleCheckBox.CheckedChanged

        'To hide or display title

        TitleLabel.Visible = TitleCheckBox.Checked

    End Sub

    Private Sub ProgrammerCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgrammerCheckBox.CheckedChanged

        'To hide or display who develops this program

        programmerLabel.Visible = ProgrammerCheckBox.Checked

    End Sub

    Private Sub CountrynameCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CountrynameCheckBox.CheckedChanged

        'TO hide or display the country group and all the RaidoButtions

        CountryGroupBox.Visible = CountrynameCheckBox.Checked

    End Sub

End Class

'Program:       Ch02HandsOn

'Programmer:    Asatryan,Nairi

'Date:          3-27-2013

'Description:   Allow the user to sign in and display current sales promotion.

Public Class MainForm

    Private Sub BooksRadioButton_CheckedChanged(ByVal sender As System.Object,

         ByVal e As System.EventArgs) Handles BooksRadioButton.CheckedChanged

        ' Display the image and promotion for the Books department.

        DepartmentPictureBox.Image = My.Resources.Books

        PromotionTextBox.Text = "Buy two, get the second one for half price."

    End Sub

    Private Sub CoffeeBarRadioButton_CheckedChanged(ByVal sender As Object,

     ByVal e As System.EventArgs) Handles CoffeeBarRadioButton.CheckedChanged

        ' Display the image and promotion for the Coffee Bar.

        DepartmentPictureBox.Image = My.Resources.Coffee

        PromotionTextBox.Text = "Celebrate the season with 20% off specialty drinks."

    End Sub

    Private Sub MusicRadioButton_CheckedChanged(ByVal sender As Object,

      ByVal e As System.EventArgs) Handles MusicRadioButton.CheckedChanged

        ' Display the image and promotion for the Music department.

        DepartmentPictureBox.Image =

            My.Resources.Music

        PromotionTextBox.Text =

            "Get a free MP3 download with purchase of a CD."

    End Sub

    Private Sub PeriodicalsRadioButton_CheckedChanged(ByVal sender As Object,

      ByVal e As System.EventArgs) Handles PeriodicalsRadioButton.CheckedChanged

        ' Display the image and promotion for the Periodicals department.

        DepartmentPictureBox.Image = My.Resources.Periodicals

        PromotionTextBox.Text = "Elite members receive 10% off every purchase."

    End Sub

    Private Sub ImageVisibleCheckBox_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles ImageVisibleCheckBox.CheckedChanged

        ' Set the visibility of the department image.

        DepartmentPictureBox.Visible = ImageVisibleCheckBox.Checked

    End Sub

    Private Sub SignInButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles SignInButton.Click

        ' Set up the screen to display the department promotions and the 

        '  welcome message. Hide the sign-in controls.

        ' Hide and disable the sign-in controls.

        CheckInGroupBox.Visible = False

        SignInButton.Enabled = False

        ' Enable the group of radio buttons.        

        DepartmentGroupBox.Enabled = True

        ' Show the promotions controls.

        PromotionTextBox.Visible = True

        ImageVisibleCheckBox.Visible = True

        WelcomeRichTextBox.Visible = True

        'Display the welcome message.

        WelcomeRichTextBox.Text = "Welcome Member #" & MemberIDMaskedTextBox.Text _

          & Environment.NewLine & NameTextBox.Text

    End Sub

    Private Sub PrintButton_Click(ByVal sender As System.Object, _

      ByVal e As System.EventArgs) Handles PrintButton.Click

        ' Print the form in the Print Preview window.

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

    Private Sub ExitButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles ExitButton.Click

        ' End the program.

        Me.Close()

    End Sub

End Class

'Project:flag

'programmer: Asatryan,Nairi

'Date: Mar 29 2013

'Description: Change the flags when you select different country RadioButtions. Also clude hide or show CheckButtons,and use tooplips to make a liitle be describution about each button.

Public Class MainForm

    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click

        'To make print ablity

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click

        'To make quit ablity

        Me.Close()

    End Sub

    Private Sub UnitedStatesRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnitedStatesRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.UnitedStates

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Football and Baseball"

    End Sub

    Private Sub JapanRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JapanRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.japan

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Terrible neighbor for Eastern Asia"

    End Sub

    Private Sub CanadaRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CanadaRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.canada

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Maple leaf"

    End Sub

    Private Sub MexicoRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MexicoRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.mexico

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Soccer,Soccer"

    End Sub

    Private Sub TitleCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TitleCheckBox.CheckedChanged

        'To hide or display title

        TitleLabel.Visible = TitleCheckBox.Checked

    End Sub

    Private Sub ProgrammerCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgrammerCheckBox.CheckedChanged

        'To hide or display who develops this program

        programmerLabel.Visible = ProgrammerCheckBox.Checked

    End Sub

    Private Sub CountrynameCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CountrynameCheckBox.CheckedChanged

        'TO hide or display the country group and all the RaidoButtions

        CountryGroupBox.Visible = CountrynameCheckBox.Checked

    End Sub

End Class

'Project:flag

'programmer: Asatryan,Nairi

'Date: Mar 29 2013

'Description: Change the flags when you select different country RadioButtions. Also clude hide or show CheckButtons,and use tooplips to make a liitle be describution about each button.

Public Class MainForm

    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click

        'To make print ablity

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click

        'To make quit ablity

        Me.Close()

    End Sub

    Private Sub UnitedStatesRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnitedStatesRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.UnitedStates

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Football and Baseball"

    End Sub

    Private Sub JapanRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JapanRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.japan

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Terrible neighbor for Eastern Asia"

    End Sub

    Private Sub CanadaRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CanadaRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.canada

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Maple leaf"

    End Sub

    Private Sub MexicoRadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MexicoRadioButton.CheckedChanged

        'When you select this button, program shows image to each flag and describe

        FlagPictureBox.Image = My.Resources.mexico

        FlagPictureBox.Visible = True

        TitleLabel.Text = "Soccer,Soccer"

    End Sub

    Private Sub TitleCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TitleCheckBox.CheckedChanged

        'To hide or display title

        TitleLabel.Visible = TitleCheckBox.Checked

    End Sub

    Private Sub ProgrammerCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgrammerCheckBox.CheckedChanged

        'To hide or display who develops this program

        programmerLabel.Visible = ProgrammerCheckBox.Checked

    End Sub

    Private Sub CountrynameCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CountrynameCheckBox.CheckedChanged

        'TO hide or display the country group and all the RaidoButtions

        CountryGroupBox.Visible = CountrynameCheckBox.Checked

    End Sub

End Class

Public Class Form1

    Dim totalvalue, totalcharge As Double

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click

        Me.Close()

    End Sub

    Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click

        Dim Valueofitem, chargeofitem As Double

        Try

            Valueofitem = Double.Parse(InputValueTextBox.Text)

            While Valueofitem <= 0

                MessageBox.Show("value cannot be equal or less than zero!")

                With InputValueTextBox

                    .SelectAll()

                    .Clear()

                    .Focus()

                End With

                Valueofitem = Double.Parse(InputValueTextBox.Text)

            End While

            chargeofitem = Valueofitem * 0.1

            totalvalue = totalvalue + Valueofitem

            totalcharge = totalcharge + chargeofitem

            PresentitemTextBox.Text = Valueofitem.ToString("C")

            ChargeTextBox.Text = chargeofitem.ToString("C")

            TotalvalueTextBox.Text = totalvalue.ToString("C")

            TotalChargeTextBox.Text = totalcharge.ToString("C")

        Catch ex As FormatException

            MessageBox.Show("Please put positive number of this value!")

        End Try

        With InputValueTextBox

            .SelectAll()

            .Clear()

            .Focus()

        End With

    End Sub

    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click

        totalvalue = 0

        totalcharge = 0

        PresentitemTextBox.Text = ""

        ChargeTextBox.Text = ""

        TotalvalueTextBox.Text = ""

        TotalChargeTextBox.Text = ""

        With InputValueTextBox

            .SelectAll()

            .Clear()

            .Focus()

        End With

    End Sub

End Class

Public Class Form1

    Dim totalvalue, totalcharge As Double

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click

        Me.Close()

    End Sub

    Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click

        Dim Valueofitem, chargeofitem As Double

        Try

            Valueofitem = Double.Parse(InputValueTextBox.Text)

            While Valueofitem <= 0

                MessageBox.Show("value cannot be equal or less than zero!")

                With InputValueTextBox

                    .SelectAll()

                    .Clear()

                    .Focus()

                End With

                Valueofitem = Double.Parse(InputValueTextBox.Text)

            End While

            chargeofitem = Valueofitem * 0.1

            totalvalue = totalvalue + Valueofitem

            totalcharge = totalcharge + chargeofitem

            PresentitemTextBox.Text = Valueofitem.ToString("C")

            ChargeTextBox.Text = chargeofitem.ToString("C")

            TotalvalueTextBox.Text = totalvalue.ToString("C")

            TotalChargeTextBox.Text = totalcharge.ToString("C")

        Catch ex As FormatException

            MessageBox.Show("Please put positive number of this value!")

        End Try

        With InputValueTextBox

            .SelectAll()

            .Clear()

            .Focus()

        End With

    End Sub

    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click

        totalvalue = 0

        totalcharge = 0

        PresentitemTextBox.Text = ""

        ChargeTextBox.Text = ""

        TotalvalueTextBox.Text = ""

        TotalChargeTextBox.Text = ""

        With InputValueTextBox

            .SelectAll()

            .Clear()

            .Focus()

        End With

    End Sub

End Class

Public Class Form1

    Dim totalvalue, totalcharge As Double

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click

        Me.Close()

    End Sub

    Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click

        Dim Valueofitem, chargeofitem As Double

        Try

            Valueofitem = Double.Parse(InputValueTextBox.Text)

            While Valueofitem <= 0

                MessageBox.Show("value cannot be equal or less than zero!")

                With InputValueTextBox

                    .SelectAll()

                    .Clear()

                    .Focus()

                End With

                Valueofitem = Double.Parse(InputValueTextBox.Text)

            End While

            chargeofitem = Valueofitem * 0.1

            totalvalue = totalvalue + Valueofitem

            totalcharge = totalcharge + chargeofitem

            PresentitemTextBox.Text = Valueofitem.ToString("C")

            ChargeTextBox.Text = chargeofitem.ToString("C")

            TotalvalueTextBox.Text = totalvalue.ToString("C")

            TotalChargeTextBox.Text = totalcharge.ToString("C")

        Catch ex As FormatException

            MessageBox.Show("Please put positive number of this value!")

        End Try

        With InputValueTextBox

            .SelectAll()

            .Clear()

            .Focus()

        End With

    End Sub

    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click

        totalvalue = 0

        totalcharge = 0

        PresentitemTextBox.Text = ""

        ChargeTextBox.Text = ""

        TotalvalueTextBox.Text = ""

        TotalChargeTextBox.Text = ""

        With InputValueTextBox

            .SelectAll()

            .Clear()

            .Focus()

        End With

    End Sub

End Class

Subject

3.2

Message

Option Strict On

 

Public Class BondsForm

 

    'Declare module-level constants.

    Const BAIL_RATE_Decimal As Decimal = 0.1D

 

    Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click

        'Calculate the amount due

        Dim BailDecimal, AmountDueDecimal As Decimal

 

        Try

            'Convert the bail amount if valid input

            BailDecimal = Decimal.Parse(BailTextBox.Text)

 

            'Perform calculations

            AmountDueDecimal = BailDecimal * BAIL_RATE_Decimal

 

            'Display results

            AmountDueTextBox.Text = AmountDueDecimal.ToString("C")

 

        Catch BailException As FormatException

            'Handle the bail amount

            MessageBox.Show("Bail amount must be numeric.", "Invalid Input",

                MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            With BailTextBox

                .Focus()

                .SelectAll()

            End With

        Catch AnException As Exception

            MessageBox.Show("Error: " & AnException.Message)

        End Try

    End Sub

 

    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click

        'Clear the form

 

        DescriptionTextBox.Clear()

        AmountDueTextBox.Clear()

        With BailTextBox

            .Clear()

            .Focus()

        End With

    End Sub

 

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click

        'End the program

 

        Me.Close()

    End Sub

 

    Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click

        'Print the form.

 

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

End Class

 

Subject

3.3

From

Groups

site

Message

 

    Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click

        'Calculate the average inventory and the turnover

        Dim BeginInventoryInteger, EndInventoryInteger,

            CostOfGoodsInteger As Integer

        Dim AverageDecimal, TurnoverDecimal As Decimal

 

        Try

            'Convert the beginning inventory amount

            BeginInventoryInteger = Integer.Parse(BeginInventoryTextBox.Text)

            Try

                'Convert the ending inventory amount

                EndInventoryInteger = Integer.Parse(EndInventoryTextBox.Text)

                Try

                    'Convert the cost of goods sold

                    CostOfGoodsInteger = Integer.Parse(CostOfGoodsTextBox.Text)

 

                    'Perform calculations

                    AverageDecimal = Convert.ToDecimal((BeginInventoryInteger + EndInventoryInteger) / 2)

                    TurnoverDecimal = CostOfGoodsInteger / AverageDecimal

 

                    'Display results

                    AverageTextBox.Text = AverageDecimal.ToString("C")

                    TurnoverTextBox.Text = TurnoverDecimal.ToString("N1")

 

                Catch CostOfGoodsException As FormatException

                    'Handle the cost of goods sold

                    MessageBox.Show("Please input a valid amount for the cost of goods sold.",

                        "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

                    With CostOfGoodsTextBox

                        .Focus()

                        .SelectAll()

                    End With

                End Try

            Catch EndException As FormatException

                'Handle the ending inventory

                MessageBox.Show("Please input a valid ending inventory amount.", _

                    "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

                With EndInventoryTextBox

                    .Focus()

                    .SelectAll()

                End With

            End Try

        Catch BeginException As FormatException

            'Handle the beginning inventory

            MessageBox.Show("Please input a valid beginning inventory amount.",

                "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            With BeginInventoryTextBox

                .Focus()

                .SelectAll()

            End With

        Catch DivisionException As ArithmeticException

            'Handle if input for beginning and ending inventory are zero.

            MessageBox.Show("You must input numeric values that are greater than zero.", "Invalid Input",

                MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            BeginInventoryTextBox.Focus()

        Catch AnException As Exception

            MessageBox.Show("Error: " & AnException.Message)

        End Try

    End Sub

 

    Private Sub ClearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearButton.Click

        'Clear the form

 

        EndInventoryTextBox.Clear()

        CostOfGoodsTextBox.Clear()

        AverageTextBox.Clear()

        TurnoverTextBox.Clear()

        With BeginInventoryTextBox

            .Clear()

            .Focus()

        End With

    End Sub

 

    Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click

        'End the program

 

        Me.Close()

    End Sub

'Project:       Ch01HandsOn

'Description:   This project displays current promotions for each department.

 

 

Public Class MainForm

 

    Private Sub BooksButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles BooksButton.Click

        ' Display the current promotion.

 

        PromotionLabel.Text = "Buy two, get the second one for half price."

        PromotionCodeLabel.Text = "B608"

    End Sub

 

    Private Sub MusicButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles MusicButton.Click

        ' Display the current promotion.

 

        PromotionLabel.Text = "Get a free MP3 download with purchase of a CD."

        PromotionCodeLabel.Text = "M608"

    End Sub

 

    Private Sub PeriodicalsButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles PeriodicalsButton.Click

        ' Display the current promotion.

 

        PromotionLabel.Text = "Elite members receive 10% off every purchase."

        PromotionCodeLabel.Text = "P608"

    End Sub

 

    Private Sub CoffeeBarButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles CoffeeBarButton.Click

        ' Display the current promotion.

 

        PromotionLabel.Text = "Celebrate the season with 20% off specialty drinks."

        PromotionCodeLabel.Text = "C608"

    End Sub

 

    Private Sub PrintButton_Click(ByVal sender As System.Object, _

      ByVal e As System.EventArgs) Handles PrintButton.Click

        ' Print the form.

 

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

 

    Private Sub ExitButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles ExitButton.Click

        ' End the program.

 

        Me.Close()

    End Sub

End Class

 

' Project:      Hello World

'Description    This project will display a "Hello World"

'               message in two different langages

'               and print the form.

 

Public Class HelloForm

 

    Private Sub PushMeButton_Click(ByVal sender As System.Object,

            ByVal e As System.EventArgs) Handles PushMeButton.Click

        ' Display the Hello World Message

 

        MessageLabel.Text = "Hello World"

    End Sub

 

    Private Sub ExitButton_Click(ByVal sender As System.Object,

        ByVal e As System.EventArgs) Handles ExitButton.Click

        ' Exit the project.

 

        Me.Close()

    End Sub

 

    Private Sub SpanishButton_Click(ByVal sender As System.Object,

        ByVal e As System.EventArgs) Handles SpanishButton.Click

        ' Display the Hellow World messafe in Spanish.

 

        MessageLabel.Text = "Hola Mundo"

    End Sub

 

    Private Sub PrintButton_Click(ByVal sender As System.Object,

            ByVal e As System.EventArgs) Handles PrintButton.Click

        ' Print the form on the printer.

 

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

End Class

 

 

 

'Project:           Ch02ChangePictures

'Description:       Allow the user to change the displayed graphic image by

'                   selecting a radio button. Demonstrates changing a picture

'                   at run time.

 

Public Class ResourcesForm

 

    Private Sub SunsetRadioButton_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles SunsetRadioButton.CheckedChanged

        ' Display the Sunset picture from the project's resources.

 

        SamplePictureBox.Image = My.Resources.Sunset

    End Sub

 

    Private Sub WaterLiliesRadioButton_CheckedChange(ByVal sender As Object,

       ByVal e As System.EventArgs) Handles WaterLiliesRadioButton.CheckedChanged

        ' Display the Water Lily picture from the project's resources.

 

        SamplePictureBox.Image = My.Resources.WaterLilies

    End Sub

 

    Private Sub WinterRadioButton_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles WinterRadioButton.CheckedChanged

        ' Display the Winter picture from the project's resources.

 

        SamplePictureBox.Image = My.Resources.Winter

    End Sub

End Class

 

 

 

'Project:       Ch02Colors

'Description:   Demonstrate changing a form's background and foreground

'               colors using two groups of radio buttons.

 

Public Class ColorsForm

 

    Private Sub BeigeRadioButton_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles BeigeRadioButton.CheckedChanged

        ' Set the form color to beige.

 

        Me.BackColor = Color.Beige

    End Sub

 

    Private Sub BlueRadioButton_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles BlueRadioButton.CheckedChanged

        ' Set the form color to blue.

 

        Me.BackColor = Color.Blue

    End Sub

 

    Private Sub YellowRadioButton_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles YellowRadioButton.CheckedChanged

        ' Set the form color to yellow.

 

        Me.BackColor = Color.Yellow

    End Sub

 

    Private Sub GrayRadioButton_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles GrayRadioButton.CheckedChanged

        ' Set the form color to gray.

 

        Me.BackColor = Color.Gray

    End Sub

 

    Private Sub BlackRadioButton_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles BlackRadioButton.CheckedChanged

        ' Set the text color to black.

 

        Me.ForeColor = Color.Black

    End Sub

 

    Private Sub WhiteRadioButton_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles WhiteRadioButton.CheckedChanged

        ' Set the text color to white.

 

        Me.ForeColor = Color.White

    End Sub

End Class

 

 

 

'Program:       Ch02HandsOn

'Description:   Allow the user to sign in and display current sales promotion.

 

Public Class MainForm

 

    Private Sub BooksRadioButton_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles BooksRadioButton.CheckedChanged

        ' Display the image and promotion for the Books department.

 

        DepartmentPictureBox.Image = My.Resources.Book

        PromotionTextBox.Text = "Buy two, get the second one for half price."

    End Sub

 

    Private Sub CoffeeBarRadioButton_CheckedChanged(ByVal sender As Object,

      ByVal e As System.EventArgs) Handles CoffeeBarRadioButton.CheckedChanged

        ' Display the image and promotion for the Coffee Bar.

 

        DepartmentPictureBox.Image = My.Resources.Coffee

        PromotionTextBox.Text = "Celebrate the season with 20% off specialty drinks."

    End Sub

 

    Private Sub MusicRadioButton_CheckedChanged(ByVal sender As Object,

      ByVal e As System.EventArgs) Handles MusicRadioButton.CheckedChanged

        ' Display the image and promotion for the Music department.

 

        DepartmentPictureBox.Image =

            My.Resources.Music

        PromotionTextBox.Text =

            "Get a free MP3 download with purchase of a CD."

    End Sub

 

 

    Private Sub PeriodicalsRadioButton_CheckedChanged(ByVal sender As Object,

      ByVal e As System.EventArgs) Handles PeriodicalsRadioButton.CheckedChanged

        ' Display the image and promotion for the Periodicals department.

 

        DepartmentPictureBox.Image = My.Resources.Periodicals

        PromotionTextBox.Text = "Elite members receive 10% off every purchase."

    End Sub

 

    Private Sub ImageVisibleCheckBox_CheckedChanged(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles ImageVisibleCheckBox.CheckedChanged

        ' Set the visibility of the department image.

 

        DepartmentPictureBox.Visible = ImageVisibleCheckBox.Checked

    End Sub

 

    Private Sub SignInButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles SignInButton.Click

        ' Set up the screen to display the department promotions and the

        '  welcome message. Hide the sign-in controls.

 

        ' Hide and disable the sign-in controls.

        CheckInGroupBox.Visible = False

        SignInButton.Enabled = False

 

        ' Enable the group of radio buttons.       

        DepartmentGroupBox.Enabled = True

 

        ' Show the promotions controls.

        PromotionTextBox.Visible = True

        ImageVisibleCheckBox.Visible = True

        WelcomeRichTextBox.Visible = True

 

        'Display the welcome message.

        WelcomeRichTextBox.Text = "Welcome Member #" & MemberIDMaskedTextBox.Text _

          & Environment.NewLine & NameTextBox.Text

    End Sub

 

    Private Sub PrintButton_Click(ByVal sender As System.Object, _

      ByVal e As System.EventArgs) Handles PrintButton.Click

        ' Print the form in the Print Preview window.

 

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

 

    Private Sub ExitButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles ExitButton.Click

        ' End the program.

 

        Me.Close()

    End Sub

End Class

 

'Project:       Ch02HandsOn

        

'Description:   This project uses labels, text boxes, radio buttons,

'              a check box, images in picture boxes, and buttons

'              to change the display.

 

Public Class MessageForm

 

    Private Sub DisplayButton_Click(ByVal sender As System.Object,

        ByVal e As System.EventArgs) Handles DisplayButton.Click

        ' Display the text in the message area.

 

        MessageLabel.Text = NameTextBox.Text & ":  " & MessageTextBox.Text

    End Sub

 

    Private Sub ClearButton_Click(ByVal sender As System.Object,

        ByVal e As System.EventArgs) Handles ClearButton.Click

        ' Clear the text controls.

 

        With NameTextBox

            ' Clear the text box.

            .Clear()

            ' Reset the insertion point.

            .Focus()

        End With

        MessageTextBox.Clear()

        MessageLabel.Text = ""

    End Sub

 

    Private Sub ExitButton_Click(ByVal sender As System.Object,

     ByVal e As System.EventArgs) Handles ExitButton.Click

        ' Exit the project.

 

        Me.Close()

    End Sub

 

    Private Sub BlackRadioButton_CheckedChanged(ByVal sender As System.Object,

        ByVal e As System.EventArgs) Handles BlackRadioButton.CheckedChanged

        ' Make the label black.

 

        MessageLabel.ForeColor = Color.Black

    End Sub

 

    Private Sub BlueRadioButton_CheckedChanged(ByVal sender As System.Object, _

        ByVal e As System.EventArgs) Handles BlueRadioButton.CheckedChanged

        ' Make the label blue.

 

        MessageLabel.ForeColor = Color.Blue

    End Sub

 

    Private Sub GreenRadioButton_CheckedChanged(ByVal sender As System.Object, _

        ByVal e As System.EventArgs) Handles GreenRadioButton.CheckedChanged

        ' Make the label green.

 

        Me.MessageLabel.ForeColor = Color.Green

    End Sub

 

    Private Sub RedRadioButton_CheckedChanged(ByVal sender As System.Object, _

        ByVal e As System.EventArgs) Handles RedRadioButton.CheckedChanged

        ' Make the label red.

 

        MessageLabel.ForeColor = Color.Red

    End Sub

 

    Private Sub BigPictureBox_Click(ByVal sender As System.Object, _

        ByVal e As System.EventArgs) Handles BigPictureBox.Click

        ' Switch the icon.

 

        BigPictureBox.Visible = False

        LittlePictureBox.Visible = True

    End Sub

 

    Private Sub LittlePictureBox_Click(ByVal sender As System.Object,

        ByVal e As System.EventArgs) Handles LittlePictureBox.Click

        ' Switch the icon.

 

        LittlePictureBox.Visible = False

        BigPictureBox.Visible = True

    End Sub

 

    Private Sub VisibleCheckBox_CheckedChanged(ByVal sender As System.Object, _

        ByVal e As System.EventArgs) Handles VisibleCheckBox.CheckedChanged

        ' Set the visibility for messageLabel.

 

        MessageLabel.Visible = VisibleCheckBox.Checked

    End Sub

End Class

 

'Project:           Ch02RichTextBoxes

'Description:       Demonstrate some of the capabilities of a Rich Text Box.

 

 

Public Class RichTextBoxForm

 

    Private Sub RichTextBoxForm_Load(ByVal sender As System.Object,

            ByVal e As System.EventArgs) Handles MyBase.Load

        ' Fill the Rich Text Boxes.

 

        TitleRichTextBox.Text = "        Pamper Yourself" & Environment.NewLine &

          "    All Your Favorite Books"

        SampleRichTextBox.LoadFile("Rich Text Boxes.rtf")

    End Sub

End Class

 

'Project:      Chapter Example BookSale

'Description:  This project inputs sales information for books.

'              It calculates the extended price and discount for

'              a sale.

'              Uses variables, constants, and calculations.

'              Note that no error trapping is included in this version

'              of the program.

'Folder:       Ch03BookSale

 

Public Class BookSaleForm

 

    ' Declare the constant.

    Const DISCOUNT_RATE_Decimal As Decimal = 0.15D

 

    Private Sub CalculateButton_Click(ByVal sender As System.Object,

       ByVal e As System.EventArgs) Handles CalculateButton.Click

 

        ' Calculate the price and discount.

        Dim QuantityInteger As Integer

        Dim PriceDecimal, ExtendedPriceDecimal, DiscountDecimal,

           DiscountedPriceDecimal As Decimal

 

        ' Convert input values to numeric variables.

        QuantityInteger = Integer.Parse(QuantityTextBox.Text)

        PriceDecimal = Decimal.Parse(PriceTextBox.Text)

 

        ' Calculate values.

        ExtendedPriceDecimal = QuantityInteger * PriceDecimal

        DiscountDecimal = Decimal.Round( _

         (ExtendedPriceDecimal * DISCOUNT_RATE_Decimal), 2)

        DiscountedPriceDecimal = ExtendedPriceDecimal - DiscountDecimal

 

        ' Format and display answers.

        ExtendedPriceTextBox.Text = ExtendedPriceDecimal.ToString("C")

        DiscountTextBox.Text = DiscountDecimal.ToString("N")

        DiscountedPriceTextBox.Text = DiscountedPriceDecimal.ToString("C")

    End Sub

 

    Private Sub ClearButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles clearButton.Click

        ' Clear previous amounts from the form.

 

        TitleTextBox.Clear()

        PriceTextBox.Clear()

        ExtendedPriceTextBox.Clear()

        DiscountTextBox.Clear()

        DiscountedPriceTextBox.Clear()

        With QuantityTextBox

            .Clear()

            .Focus()

        End With

    End Sub

 

    Private Sub PrintButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles PrintButton.Click

        'Print the form.

 

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

 

    Private Sub ExitButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles ExitButton.Click

        ' Exit the project.

 

        Me.Close()

    End Sub

End Class

 

'Project:      Ch03HandsOn  

'Description:  This project inputs sales information for books.

'              It calculates the extended price and discount for

'              a sale and maintains summary information for all

'              sales.

'              Uses variables, constants, calculations, error

'              handling, and a message box to the user.

'Folder:       Ch03HandsOn

 

Public Class BookSaleForm

 

    ' Declare module-level variables and constants.

    Private QuantitySumInteger, SaleCountInteger As Integer

    Private DiscountSumDecimal, DiscountedPriceSumDecimal As Decimal

    Const DISCOUNT_RATE_Decimal As Decimal = 0.15D

 

    Private Sub PrintButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles PrintButton.Click

        ' Print the form.

 

        PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview

        PrintForm1.Print()

    End Sub

 

    Private Sub CalculateButton_Click(ByVal sender As System.Object,

       ByVal e As System.EventArgs) Handles CalculateButton.Click

        ' Calculate the price and discount.

        Dim QuantityInteger As Integer

        Dim PriceDecimal, ExtendedPriceDecimal, DiscountDecimal,

          DiscountedPriceDecimal, AverageDiscountDecimal As Decimal

 

        Try

            ' Convert quantity to numeric variable.

            QuantityInteger = Integer.Parse(QuantityTextBox.Text)

 

            Try

                ' Convert price if quantity was successful.

                PriceDecimal = Decimal.Parse(PriceTextBox.Text)

                ' Calculate values for sale.

                ExtendedPriceDecimal = QuantityInteger * PriceDecimal

                DiscountDecimal = Decimal.Round( _

                 (ExtendedPriceDecimal * DISCOUNT_RATE_Decimal), 2)

                DiscountedPriceDecimal = ExtendedPriceDecimal - DiscountDecimal

 

                ' Calculate summary values.

                QuantitySumInteger += QuantityInteger

                DiscountSumDecimal += DiscountDecimal

                DiscountedPriceSumDecimal += DiscountedPriceDecimal

                SaleCountInteger += 1

                AverageDiscountDecimal = DiscountSumDecimal / SaleCountInteger

 

                ' Format and display answers for the sale.

                ExtendedPriceTextBox.Text = ExtendedPriceDecimal.ToString("C")

                DiscountTextBox.Text = DiscountDecimal.ToString("N")

                DiscountedPriceTextBox.Text = DiscountedPriceDecimal.ToString("C")

 

                ' Format and display summary values.

                QuantitySumTextBox.Text = QuantitySumInteger.ToString()

                DiscountSumTextBox.Text = DiscountSumDecimal.ToString("C")

                DiscountAmountSumTextBox.Text = DiscountedPriceSumDecimal.ToString("C")

                AverageDiscountTextBox.Text = AverageDiscountDecimal.ToString("C")

 

            Catch PriceException As FormatException

                ' Handle a price exception.

                MessageBox.Show("Price must be numeric.", "Data Entry Error",

                MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

                With PriceTextBox

                    .Focus()

                    .SelectAll()

                End With

            End Try

 

        Catch QuantityException As FormatException

            ' Handle a quantity exception.

            MessageBox.Show("Quantity must be numeric.", "Data Entry Error", _

               MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            With QuantityTextBox

                .Focus()

                .SelectAll()

            End With

 

        Catch AnException As Exception

            ' Handle any other exception.

            MessageBox.Show("Error: " & AnException.Message)

        End Try

    End Sub

 

    Private Sub ClearButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles ClearButton.Click

        ' Clear previous amounts from the form.

 

        TitleTextBox.Clear()

        PriceTextBox.Clear()

        ExtendedPriceTextBox.Clear()

        DiscountTextBox.Clear()

        DiscountedPriceTextBox.Clear()

        With QuantityTextBox

            .Clear()

            .Focus()

        End With

    End Sub

 

    Private Sub ExitButton_Click(ByVal sender As System.Object,

      ByVal e As System.EventArgs) Handles ExitButton.Click

        ' Exit the project.

 

        Me.Close()

    End Sub

End Class

Please make sure to put Programmer as Asatryan,Nairi