An unhandled exception of type 'System.StackOverflowException' occurred in System.Windows.Forms.dll?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi friendz...
i am developing c# application. i have datagirdview in my form. i have written txtBox_Leave . when this event is triggured the following error coming.
An unhandled exception of type System.StackOverflowException occurred in System.Windows.Forms.dll?
this is my code.
<span style="font-size:x-small <font size="2

</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small private<span style="font-size:x-small
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small void<span style="font-size:x-small txtBox_Leave(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small object<span style="font-size:x-small
sender, <span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small EventArgs<span style="font-size:x-small e)

{
<font size="2

</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small int<span style="font-size:x-small n = dataGridView1.CurrentCell.ColumnIndex;<font size="2


</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small if<span style="font-size:x-small (n == 1)

{
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[4];
error comes on this line
<font size="2
dataGridView1.BeginEdit(
</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small true<span style="font-size:x-small );<font size="2


</font>

<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small MessageBox<span style="font-size:x-small .Show(n +
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "hi"<span style="font-size:x-small );

}
<font size="2

</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small try
<span style="font-size:x-small
{
<font size="2

</font>
<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small string<span style="font-size:x-small txt1 = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[4].Value.ToString();<font size="2


</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small string<span style="font-size:x-small txt2 = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[5].Value.ToString();<font size="2


</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small double<span style="font-size:x-small t1 =
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small Convert<span style="font-size:x-small .ToDouble(txt1);<font size="2


</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small double<span style="font-size:x-small t2 =
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small Convert<span style="font-size:x-small .ToDouble(txt2);<font size="2


</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small double<span style="font-size:x-small t = t1 * t2;<font size="2


</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small string<span style="font-size:x-small tt = t.ToString(<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "0.00"<span style="font-size:x-small );

dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[6].Value = tt;
}
<font size="2

</font>

<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small catch<span style="font-size:x-small (System.<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small Exception<span style="font-size:x-small )

{ }
<font size="2

</font>

<span style="color:#008000; font-size:x-small <span style="color:#008000; font-size:x-small //GridTotal
<span style="font-size:x-small <font size="2
txtSubTotal.Text = Total().ToString(
</font>
<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "0.00"<span style="font-size:x-small );<font size="2

txtTotal.Text = Total().ToString(
</font>

<span style="color:#a31515; font-size:x-small <span style="color:#a31515; font-size:x-small "0.00"<span style="font-size:x-small );



}


pls help me
thank you
faisal


View the full article
 
Back
Top