שתף באמצעות


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

Question

Monday, August 7, 2017 5:33 PM

Hello Every Body

I want to try to run this codes in a subrotin

    Dim dblInPrice As Double
        Dim dblBfInPrice1 As Double
        Dim dblBfInPrice2 As Double
        Dim dblBfInPrice3 As Double

        If txtQuanty.Text = Nothing Then
            txtOrderPrice.Text = Nothing
            txtTotal.Text = Nothing
            Exit Sub
        End If




        If txtPrice.Text = Nothing Then
            dblInPrice = 0
        Else
            dblInPrice = Double.Parse(txtPrice.Text, Globalization.NumberStyles.Any)
        End If


        If txtBfInPrice3.Text = Nothing Then
            dblBfInPrice3 = 0
        Else
            dblBfInPrice3 = Double.Parse(txtBfInPrice3.Text, Globalization.NumberStyles.Any)
        End If

        txtPrice.Text = FormatNumber(dblInPrice, 0)


        dblBfInPrice2 = Math.Round((dblInPrice / 100) * dcmlPClassPrecent)
        dblBfInPrice1 = Math.Round(((dblInPrice + dblBfInPrice2) / 100) * dcmlTaxPrecent)

        txtBfInPrice1.Text = dblBfInPrice2

but i see an error on this line..

 txtBfInPrice1.Text = dblBfInPrice2

now. how to fix this error

please help me

thanks all.

Name of Allah, Most Gracious, Most Merciful and He created the human

All replies (6)

Tuesday, August 8, 2017 7:12 AM

Hi sh4015,

At my side, I cannot reproduce this issue, can you add one breakpoint in your code , and see What is the value of dblBfInPrice2?

Best Regards,

Cherry

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


Tuesday, August 8, 2017 7:39 AM

txtBfInPrice1.Text = dblBfInPrice2.ToString

If you want decimals then you have to use that overload from tostring

I don't know if you use a translator. But you use always an end text which is for many persons in the world very offending. 

Success
Cor


Tuesday, August 8, 2017 7:40 AM

I want to try to run this codes in a subrotin

The most likely cause for this error is that you have an event that runs code that causes the event to fire that runs code that causes the event to fire that ... and the system runs out of stack space.  Is this code running in the TextChanged event handler for txtBFInPrice1?  If it is, then you cannot make a change to txtBFInPrice1.Text unless you disable the event handler first.


Thursday, August 17, 2017 10:19 AM

Hi sh4015,

Have your solved your issue now, it yes, please update here if your are free.

Thanks for your understanding.

Best Regards,

Cherry

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


Thursday, September 21, 2017 5:49 AM

thanks dear

my problem is not solve  )-:

Name of Allah, Most Gracious, Most Merciful and He created the human


Thursday, September 21, 2017 6:27 AM

my problem is not solve

You need to answer the question:  Is this code running in the TextChanged event handler for txtBFInPrice1?

If it is, then that's the problem.   If it isn't, then you need to look at what other code might be executing for any of the textchanged events for the text boxes that you are updating.