hi

this is my code and I am trying to write a simple code to generate total and grand total.
I have id,name,quantity,price,total,grand total
'total' works perfectly,but I am having problem getting GT to work.
here is the code....
the error I am getting is "Input string was not in correct format"

private void textBox3_TextChanged(object sender, EventArgs e)
        {
            if ((textBox3.Text != "") && (textBox4.Text != ""))
            {
                textBox5.Text = (Convert.ToDouble(textBox3.Text) * Convert.ToDouble(textBox4.Text)).ToString();
                textBox6.Text = (Convert.ToDouble(textBox5.Text) + Convert.ToDouble(textBox6.Text)).ToString();
            }
        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {
            if ((textBox3.Text !="") && (textBox4.Text!=""))
            {
                textBox5.Text = (Convert.ToDouble(textBox3.Text) * Convert.ToDouble(textBox4.Text)).ToString();
                textBox6.Text = (Convert.ToDouble(textBox5.Text) + Convert.ToDouble(textBox6.Text)).ToString();
            }
        }

Edited 3 Years Ago by salesman91: edit

id,name,quantity,price,total,grand total

no just six..sixth one is GT

So Textbox5 is the total price, and Textbox6 is the total price(Textbox5) + the contents of Textbox6. But Textbox6 contains nothing and you probably will get some sort of exception I guess.

never mind bro...u r right though...

here is the code which works for me...

Edited 3 Years Ago by salesman91: edit

private void textBox3_TextChanged(object sender, EventArgs e)
        {
            if ((textBox3.Text != "") && (textBox4.Text != ""))
            {
                textBox5.Text = (Convert.ToDouble(textBox3.Text) * Convert.ToDouble(textBox4.Text)).ToString();
                textBox6.Text = "";
                textBox6.Text += Convert.ToDouble(textBox5.Text);
             }

        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {
            if ((textBox3.Text != "") && (textBox4.Text!=""))
            {
                textBox5.Text = (Convert.ToDouble(textBox3.Text) * Convert.ToDouble(textBox4.Text)).ToString();
                textBox6.Text = "";

                textBox6.Text += Convert.ToDouble(textBox5.Text);           
            }


        }

Hi - I have the below code to calculate EI2/MV2. The code works for subtotal when the numerator is 0 but it does not work for grandtotal so when my grandtotal numerator EI2 is 0 it gives "Exception has been thrown by the target of an invocation". Does anyone know how i can get around that? THank you

decimal EI2;
decimal MV2;

DataDynamics.ActiveReports.TextBox TBV2;
DataDynamics.ActiveReports.TextBox TBY2;

TBY2 = (DataDynamics.ActiveReports.TextBox) rpt.Sections["GroupFooter2"].Controls["TextBox9"];

TBV2 = (DataDynamics.ActiveReports.TextBox) rpt.Sections["GroupFooter2"].Controls["TextBox8"];
MV2 = System.Convert.ToDecimal(TBV2.Value);

TBV2 = (DataDynamics.ActiveReports.TextBox) rpt.Sections["GroupFooter2"].Controls["TextBox20"];
EI2 = System.Convert.ToDecimal(TBV2.Value);

{
if (MV2 != 0)
{
    TBY2.Value = (EI2 / MV2) * 100;
}
else
{
    TBY2.Value = 0;
}
}   

@hdojms
You prbabaly missed this message at the end of this thread:
This question has already been solved: Start a new discussion instead
In your new thread, you may always refer to this one, but don't append to a solved question please.

This question has already been answered. Start a new discussion instead.