I would like some help with my code because i am getting a bunch of errors.

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using Options;
using System.Windows.Forms;

namespace InvestorPlus
{
    public partial class MainPg : Form
    {
        public MainPg()
        {
            InitializeComponent();
        }

        private void btnPay_Click(object sender, EventArgs e)
        {
            new Payments().Show();
        }

        private void btnBal_Click(object sender, EventArgs e)
        {
            new Loan_Balance().Show();
        }

        private void btnAn_Click(object sender, EventArgs e)
        {
            new Desired_Annuity().Show();
        }

        private void btnFut_Click(object sender, EventArgs e)
        {
            new Future_Value().Show();
        }

        private void btnInit_Click(object sender, EventArgs e)
        {
            new Initial_Investment().Show();
        }

        private void btnMax_Click(object sender, EventArgs e)
        {
            new Maximum_Annuity().Show();
        }

        private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void splitContainer1_Panel1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void MainPg_Load(object sender, EventArgs e)
        {

        }

        private void lblSavings_Click(object sender, EventArgs e)
        {

        }

        private void groupBox3_Enter(object sender, EventArgs e)
        {

        }





        private void groupBox4_Enter(object sender, EventArgs e)
        {

        }

        private void groupBox2_Enter(object sender, EventArgs e)
        {

        }

        private void groupBox2_Enter_1(object sender, EventArgs e)
        {

        }

        private void textBox5_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void btnBuy_Click(object sender, EventArgs e)
        {
            int intOptionQuantity = txtQuantity.Text;
            string strSymbol = txtSymbol.Text;
            If cboCallPut.Text = "CALL" Then
                If myPortfolio.ContainsKey(strSymbol) = False Then
                    CallOption myOption = new CallOption(txtSymbol.Text,intOptionQuantity);
                myPortfolio.Add(strSymbol, myOption);
            else 
                myPortfolio(strSymbol).Quantity += intOptionQuantity;
                if (myPortfolio(strSymbol).Quantity == 0) myPortfolio.Remove(strSymbol);
            else
                If myPortfolio.ContainsKey(strSymbol) = False Then 
                    PutOption myOption = new PutOption(txtSymbol.Text, intOptionQuantity);
                myPortfolio.Add(strSymbol, myOption);
            else
                myPortfolio(strSymbol).Quantity() += intOptionQuantity;
                if (myPortfolio(strSymbol).Quantity == 0) myPortfolio.Remove(strSymbol); 

            ListPortfolioElements();

        }

        private void btnSell_Click(object sender, EventArgs e)
        {
            int intOptionQuantity = txtQuantity.Text;
            string strSymbol = txtSymbol.Text;
            If cboCallPut.Text = "CALL" Then
                If myPortfolio.ContainsKey(strSymbol) = False Then
                    CallOption myOption = new CallOption(txtSymbol.Text,intOptionQuantity);
                myPortfolio.Add(strSymbol, myOption);
            else
                myPortfolio(strSymbol).Quantity -= intOptionQuantity;
                if (myPortfolio(strSymbol).Quantity == 0) myPortfolio.Remove(strSymbol);

            else
                If myPortfolio.ContainsKey(strSymbol) = False Then 
                    PutOption myOption = new PutOption(txtSymbol.Text, intOptionQuantity);
                        myPortfolio.Add(strSymbol, myOption);
            else 
                myPortfolio(strSymbol).Quantity() -= intOptionQuantity;
                if (myPortfolio(strSymbol).Quantity == 0) myPortfolio.Remove(strSymbol); 
            ListPortfolioElements();




        }

        private void btnRetrieve_Click(object sender, EventArgs e)
        {
            string strSymbol = txtSymbol.Text;
            object resultOption = myPortfolio(strSymbol);
            If Not resultOption Is nothing Then 
                txtPortStatus.Text == "Retrieved: " + resultOption.ToString()
            else
                txtPortStatus.Text == txtSymbol.Text + " not in the Portfolio."
            ListPortfolioElements();

        }

        private void btnIsEmpty_Click(object sender, EventArgs e)
        {
            If myPortfolio.Count = 0 Then
                txtPortStatus.Text == "Portfolio is empty."
            else
                txtPortStatus.Text == "Portfolio is not empty."
            ListPortfolioElements();
        }

        private void btnContains_Click(object sender, EventArgs e)
        {
             var strSymbol = txtSymbol.Text;
             txtPortStatus.Text = "Contains: " + myPortfolio.ContainsKey(strSymbol);
        }

        private void btnGetOut_Click(object sender, EventArgs e)
        {
            myPortfolio.Clear();
            txtPortStatus.Text == "You are out. Portfolio is now empty."
            ListPortfolioElements();
        }

        private void btnListKeys_Click(object sender, EventArgs e)
        {
            IDictionaryEnumerator enumerator = myPortfolio.GetEnumerator();
            txtPortfolio.Text == "PORTFOLIO KEYS:" + Constants.vbCrLf;
            While enumerator.MoveNext()
                txtPortfolio.Text += enumerator.Key + Constants.vbCrLf;
            end While

        }
        Private Sub ListPortfolioElements();
            IDictionaryEnumerator enumerator = myPortfolio.GetEnumerator();
            txtPortfolio.Text = "PORTFOLIO ELEMENTS:" + Constants.vbCrLf;
            While enumerator.MoveNext()
            txtPortfolio.Text += enumerator.Value.ToString & vbCrLf
            End While


        private void btnCompDelta_Click(object sender, EventArgs e)
        {
            IDictionaryEnumerator enumerator = myPortfolio.GetEnumerator();
            double myDelta = 0;
          while (enumerator.MoveNext()) {
             enumerator.Value.StockPrice() = Conversion.Val(txtStockPrice.Text);
             enumerator.Value.Volatility() = Conversion.Val(txtVolatility.Text);
             myDelta += (enumerator.Value.Quantity * enumerator.Value.Delta);
            }
        }
}
}

Edited 3 Years Ago by pyTony: fixed formatting

Hmm, no code tags makes it hard to read - why not tell us what errors you're getting, and what you've tried to fix it so far

This article has been dead for over six months. Start a new discussion instead.