Click here to Skip to main content
15,067,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have written c# project about similarity between tow sin curve and it hasn't any error and compile
but it doesn't work and my form hang up!
i have used 3 function in my form and when click on one button it should execute them!
in my functions i have used array and the collection(list of double values)
should i use class ????

please help me

one of mu function is like below:

private void ASCI4(double[] x, int width)
         double[] up = new double[width];
         double[] lp = new double[width];
         double[] ud = new double[width];
         double[] ld = new double[width];
         for(int i=0;i<width;i++)



          ld[i] = x[i] - 0.5;
         foreach (double up1 in UP)
             foreach (double ud1 in UD)
                 foreach (double lp1 in LP)
                     foreach (double ld1 in LD)
                         foreach (Point v1 in V)
                             if ((v1.Y > lp1) & (v1.Y < up1))

                             else if ((v1.Y < ld1) | (v1.Y > ud1))
                             else if (((v1.Y >= ld1) & (v1.Y <= lp1)) | ((v1.Y >= up1) & (v1.Y <= ud1)))

[edit]Code block added - OriginalGriff[/edit]
Updated 21-Jun-13 22:20pm

1 solution

You are surprised?
I'm not.

I don't know what value you are passing through as the width, but you then proceed to nest loops that will be at least width^5 iterations of the inner loop. (More, probably, since you don't clear your class level lists before you add new elements, and we can't see the number of elements in V) So, if your width is 5, then your inner loop is executed 3125 times. If it is 20, then it;'s 3,200,000 times round, and so forth, each time adding elements to a list...

Your form will do nothing until all iterations are complete. There are things you can do to prevent that, but first I think you need to look at this and work out if that is what you actually intended...

"onemore question
how can i send a textbox value from one form to another form and assign tetbox value to one variable???"

Depends on the relationship between the forms.
You don't send the textbox, you send the Text property string and let the other form decide what to do with it.
Have a look at these: one of them will describe the relationship and explain what to do.
Transferring information between two forms, Part 1: Parent to Child[^]
Transferring information between two forms, Part 2: Child to Parent[^]
Transferring information between two forms, Part 3: Child to Child[^]
pegah67 22-Jun-13 7:41am
what should i do for solve this problem!!!
now that i'm showing again at my codes i see you're right!!!
that all Comparisons are neccessary and shuld be done in my project!!!!!
please help me
OriginalGriff 22-Jun-13 7:46am
Then the only thing you can do is move them into a different thread.
Try a BackgroundWorker
The link includes an example.
pegah67 22-Jun-13 8:48am
i'm beginner it's too hard for me :(
one more question:
i have an double array and want to draw sin curve with vlue of array's elements
how can i do this??
OriginalGriff 22-Jun-13 9:33am
Read the link - the example is pretty clear, and it's not that complex! It's probably half a dozen lines of code, is all.

Drawing a graph is harder than using threads! But this is probably where you want to start:
pegah67 23-Jun-13 2:27am
thank you for your help :)
OriginalGriff 23-Jun-13 3:20am
You're welcome!
OriginalGriff 23-Jun-13 6:37am
Answer updated.

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