Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am stuck up with stack over flow error exception in my code.Please Could you help me? and also this error could not be caught by try and catch block which exception handling should i have to handle to recover that error? please suggest me
Posted
Updated 28-Dec-13 23:18pm
v3
Comments
Post the code snippet.
OriginalGriff 25-Dec-13 3:29am    
Without seeing your code, we can't tell - we don;t know how you have written your recursive routine.
We have a good idea of what you generally have done which could cause it, but that wouldn't help you much, and it would be so generic that it would fit your code.
So, we need to see the recursive method you have written, to identify the error.
Use the "Improve question" widget to edit your question and provide better information - just the method should be enough.
agent_kruger 29-Dec-13 5:19am    
without posting your code and without knowing in which line you receive the error we cannot help you ,my dear friend.

1 solution

my friend problem is where ever you use txtbxGrandTotal.Text to set value your txtbxGrandTotal_TextChanged will be called again and again. So try not setting values on txtbxGrandTotal_TextChanged
 
Share this answer
 
v3
Comments
ganesh89_babu 25-Dec-13 4:27am    
private void Calculation()
{
if (txtSubTotal.Text != "")
{
SubTotal = double.Parse(txtSubTotal.Text);
}
else if (txtSubTotal.Text == "")
{
SubTotal = 0;
}
if (txtTax2.Text != "")
{
ServiceAmt = double.Parse(txtTax2.Text);
}
else if (txtTax2.Text == "")
{
ServiceAmt = 0;
}
if (txtbxVatAmt.Text != "")
{
VatAmt = double.Parse(txtbxVatAmt.Text);
}
else if (txtbxVatAmt.Text == "")
{
VatAmt = 0;
}
if (txtbxGrandTotal.Text != "")
{
GrandTotal = double.Parse(txtbxGrandTotal.Text);
}
else if (txtbxGrandTotal.Text == "")
{
GrandTotal = 0;
}
GrandTotal = SubTotal + ServiceAmt + VatAmt;
txtSubTotal.Text = SubTotal.ToString();

if (txtbxDiscount.Text != "")
{
Discount = double.Parse(txtbxDiscount.Text);
}
else if (txtbxDiscount.Text == "")
{
Discount = 0;
}
PayableAmt = Convert.ToDouble(txtbxGrandTotal.Text) - Discount;
txtbxPayableAmt.Text = PayableAmt.ToString();

}


private void txtbxGrandTotal_TextChanged(object sender, EventArgs e)
{
NumberToEnglish num1 = new NumberToEnglish();
txtbxRupeesinWords.Text = num1.changeCurrencyToWords(txtbxGrandTotal.Text);
RupeesinWords = txtbxRupeesinWords.Text.ToString();


if (txtbxGrandTotal.Text == ".")
{
txtbxGrandTotal.Text = "0".ToString();
}
double decpart, Roundoff;
double num = Convert.ToDouble(GrandTotal);
int intpart = (int)num;
decpart = num - intpart;
txtRoundOff.Text = Convert.ToString(Math.Round((decpart), 2));
Roundoff = Convert.ToDouble(txtRoundOff.Text);
if (Roundoff > 0.50)
{
txtRoundOff.Text = (1 - Roundoff).ToString();
txtbxGrandTotal.Text = (intpart + 1).ToString();
}
else
{
txtRoundOff.Text = Roundoff.ToString();
txtbxGrandTotal.Text = (intpart).ToString();
}
Calculation();
}
agent_kruger 25-Dec-13 4:31am    
and in which line does the error shows in.
ganesh89_babu 25-Dec-13 4:32am    
txtbxGrandTotal.Text =(intpart).ToString();
ganesh89_babu 25-Dec-13 4:28am    
for each and every method i have called that method calculation...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900