Translate To Preferred Language

Search Obioku's Thoughts

Please Read Today's Featured Post

Things I Would Like To Happen Soon

For all those who believe in speaking ideas into existence and prayer in the universe will return to a person.  I simply want to write a lis...

Template for A SportsStore in Visual Basic (some bugs may occur)

Public Class frmSports

    Private intAmount As Integer = 0I
    Private strSize As String
    Private decTotalCost As Decimal
    Private strOrder As String
    Private strTeamChoice As String = String.Empty

    Private Sub frmSports_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Threading.Thread.Sleep(2000)
    End Sub

    Private Sub cbSport_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbSport.SelectedIndexChanged
        Dim intchoice = cbSport.SelectedIndex
        lstTeams.Items.Clear()
        Select Case intchoice
            Case 0
                Baseball()
            Case 1
                Basketball()
            Case 2
                Football()
            Case 3
                Hockey()
        End Select

        lstTeams.Visible = True
        lstSize.Visible = True
        btnCost.Visible = True
        btnClear.Visible = True
        btnExit.Visible = True

    End Sub

    Private Sub Baseball()
        lstTeams.Items.Add("Atlanta Braves")
        lstTeams.Items.Add("Boston Red Sox")
        lstTeams.Items.Add("Chicago Cubs")
        lstTeams.Items.Add("Los Angeles Dodgers")
        lstTeams.Items.Add("New York Yankees")
        lstTeams.Items.Add("San Francisco Giants")

    End Sub

    Private Sub Basketball()
        lstTeams.Items.Add("Boston Celtics")
        lstTeams.Items.Add("Chicago Bulls")
        lstTeams.Items.Add("Cleveland Cavaliers")
        lstTeams.Items.Add("Miami Heat")
        lstTeams.Items.Add("Los Angeles Lakers")
        lstTeams.Items.Add("San Antonio Spurs")
    End Sub

    Private Sub Football()
        lstTeams.Items.Add("Dallas Cowboys")
        lstTeams.Items.Add("Green Bay Packers")
        lstTeams.Items.Add("New England Patriots")
        lstTeams.Items.Add("Oakland Raiders")
        lstTeams.Items.Add("Pittsburgh Steelers")
        lstTeams.Items.Add("San Francisco 49ers")
    End Sub

    Private Sub Hockey()
        lstTeams.Items.Add("Boston Bruins")
        lstTeams.Items.Add("Detroit Red Wings")
        lstTeams.Items.Add("Edmonton Oilers")
        lstTeams.Items.Add("Los Angeles Kings")
        lstTeams.Items.Add("New York Rangers")
        lstTeams.Items.Add("Pittsburg Penguins")
    End Sub

    Private Sub btnCost_Click(sender As Object, e As EventArgs) Handles btnCost.Click
        'Dim intAmount As Integer
        Dim intChoice As Integer
        Dim strChoice As String
        Dim intSport As Integer
        Dim intSize As Integer
        Dim decTotal As Decimal

        intSport = cbSport.SelectedIndex
        intAmount += 1
        Select Case intSport
            Case 0
                decTotal = BaseTeam(intChoice, intSize)
            Case 1
                decTotal = BasketTeam(intChoice, intSize)
            Case 2
                decTotal = FootTeam(intChoice, intSize)
            Case 3
                decTotal = HockTeam(intChoice, intSize)
        End Select

        decTotalCost += decTotal
        strOrder = "You have added the " & cbSport.Text & "'s " & strTeamChoice & " Jersey is size " & lstSize.Text

        lblSelection.Text = strOrder.ToString()
        lblSelection.Visible = True

        lblOrder.Text = "You have " & intAmount.ToString() & " shirts for " & decTotalCost.ToString("C")
        lblOrder.Visible = True

    End Sub

    Private Function BaseTeam(ByVal intChoice As Integer, ByVal intSize As Integer) As Decimal
        Dim decPrice As Decimal = 149.99D
        Dim decTotalPrice As Decimal

        strTeamChoice = lstTeams.SelectedItem.ToString()
        decTotalPrice = decPrice * 1.06D

        Return decTotalPrice
    End Function

    Private Function BasketTeam(ByVal intChoice As Integer, ByVal intSize As Integer) As Decimal
        Dim decPrice As Decimal = 179.99D
        Dim decTotalPrice As Decimal

        strTeamChoice = lstTeams.SelectedItem.ToString()
        decTotalPrice = decPrice * 1.06D

        Return decTotalPrice
    End Function

    Private Function FootTeam(ByVal intChoice As Integer, ByVal intSize As Integer) As Decimal
        Dim decPrice As Decimal = 199.99D
        Dim decTotalPrice As Decimal

        strTeamChoice = lstTeams.SelectedItem.ToString()
        decTotalPrice = decPrice * 1.06D

        Return decTotalPrice
    End Function

    Private Function HockTeam(ByVal intChoice As Integer, ByVal intSize As Integer) As Decimal
        Dim decPrice As Decimal = 219.99D
        Dim decTotalPrice As Decimal

        strTeamChoice = lstTeams.SelectedItem.ToString()
        decTotalPrice = decPrice * 1.06D

        Return decTotalPrice
    End Function

    Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
        Close()
    End Sub

    Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
        lstSize.Visible = False
        lstTeams.Visible = False
        lblOrder.Visible = False
        lblSelection.Visible = False
        intAmount = 0
        decTotalCost = 0
        cbSport.Focus()

    End Sub
End Class

Public NotInheritable Class SplashScreen1

    'TODO: This form can easily be set as the splash screen for the application by going to the "Application" tab
    '  of the Project Designer ("Properties" under the "Project" menu).


    Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Set up the dialog text at runtime according to the application's assembly information. 

        'TODO: Customize the application's assembly information in the "Application" pane of the project
        '  properties dialog (under the "Project" menu).

        'Application title
        If My.Application.Info.Title <> "" Then
            ApplicationTitle.Text = My.Application.Info.Title
        Else
            'If the application title is missing, use the application name, without the extension
            ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
        End If

        'Format the version information using the text set into the Version control at design time as the
        '  formatting string.  This allows for effective localization if desired.
        '  Build and revision information could be included by using the following code and changing the
        '  Version control's designtime text to "Version {0}.{1:00}.{2}.{3}" or something similar.  See
        '  String.Format() in Help for more information.
        '
        '    Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision)

        Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor)

        'Copyright info
        Copyright.Text = My.Application.Info.Copyright
    End Sub

End Class


No comments:

Post a Comment

Thank you very much for viewing this entry and I hope you are able to return soon to continue to enjoy more of the site.
Please share your thoughts in the comment section.
Be blessed and enjoy life!