//Pre: The file path leads to a txt file detailing each items traits,seperated by commas
        //Post: Return the resulting area as a real
        //Description: Calculate the area of a rectangle given a specific length and width
        private void bttnImportInventory_Click(object sender, EventArgs e)
        {
            try
            {
                // Assigns the result of the open file dialogue to a variable
                DialogResult result = ofdFileFinder.ShowDialog();

                // Once the file is selected (and they press ok), its file path is used to create a new inventory
                if (result == DialogResult.OK)
                {
                    filePath  = ofdFileFinder.FileName;
                    inventory = new Inventory(filePath);

                    // The contents of the file are read and assigned to the list box to be displayed as a string
                    listInventory.DataSource = inventory.ReadFile();
                }
            }
            catch (FileNotFoundException)
            {
                lblMessage.Text = "The file was not found";
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Error: " + ex.Message;
            }
        }
        public InventoryManagement()
        {
            InitializeComponent();

            // Set the begining index to the first item in the list, which details the function of the drop down list
            cmbxItemType.SelectedIndex  = 0;
            cmbxSearchBy.SelectedIndex  = 0;
            cmbxItemTrait.SelectedIndex = 0;


            try
            {
                // Retrieves the file path of inventory.txt from the program files
                filePath = Application.StartupPath + "/inventory.txt";

                // Creates the new inventory based on the file path
                inventory = new Inventory(filePath);

                // The contents of the file are read and assigned to the list box to be displayed as a string
                listInventory.DataSource = inventory.ReadFile();
            }
            catch (FileNotFoundException)
            {
                lblMessage.Text = "The file was not found";
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Error: " + ex.Message;
            }
        }