A first chance exception of type 'System.InvalidOperationException'

Status
Not open for further replies.

otuatail

Active member
Joined
May 25, 2011
Messages
28
Programming Experience
5-10
Hi I get this when I run this applicatiom

A first chance exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll

It is a very basic application. Also how can I modify the title bar in code?

VB.NET:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace InterestCalculator
{
    public partial class cmdInterest : Form
    {
        public cmdInterest()
        {
            InitializeComponent();
        }
        private void cmdCalculate_Click(object sender, EventArgs e)
        {
            decimal cInitial;
            //int iMonths;
            //decimal cInterest;
            decimal cCurrent;
            decimal val;
            int mystart;
            cInitial = decimal.Parse(txtInitial.Text);
            cCurrent = cInitial;
            val = (decimal.Parse(txtMonthly.Text) / 100) + 1;
            for (mystart = 0; mystart < int.Parse(txtMonths.Text); mystart++)
 
            {
                cCurrent = cCurrent * val;
            }
            cCurrent = cCurrent - cInitial;
            txtResult.Text = cCurrent.ToString("#,###0.00");
        }
        private void cmdInterest_Load(object sender, EventArgs e)
        {
            ActiveForm.Text = "Des Ver: 1.2.5 (September 2012)";
            cmdInterest.ActiveForm.Top = 0;
            //this.Text = "Desmond";
        }
    }
}
 
Status
Not open for further replies.
Back
Top