Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ok, so I have a method inside which I cannot use This.close for it always crashes. The main operational block of the method is lower. Inside my method, all other things are mainly declarations or calls to other methods. Any ideas?

for (int i = 0; i < Metode.DESCHIDERI.Length; i++)
{
    int j = Metode.DESCHIDERI[i];

    p2 = new Point((marginiDeschideri[j * 2].X+marginiDeschideri[j*2+1].X)/2, p1.Y);
    Point pp1 = p1;
    Point pp2 = new Point(p2.X + Convert.ToInt16(LSUPRA), p2.Y);
    if ((pp1.X - pp2.X) > L)
    {
        gbmp.Dispose();
        this.Close();
    }
    else
    {
        gbmp.DrawLine(myPen, pp1, pp2);
        if (s == 0)
            s = 10;
        else
            s = -10;
        p1 = new Point(p2.X - Convert.ToInt16(LSUPRA), p2.Y + s);
    }
}


EDIT: It seems to me I have a problem with this.close() because it does not stop execution. For instance, under debug mode, I can see it clearly going over to this.close() and then over to the next instructions like nothing happened.
EDIT: Wherever I put this.close() inside this method, or others, I get the error.
Posted
Updated 26-Apr-10 0:13am
v4

You are talking about this.Close() and all but I don't see it anywhere in your code. Add more code if you want people to give you good awnsers.

As for the gbmp this is your graphics stuff. Are you disposing it correctly before this.close() occurs?
 
Share this answer
 
Do you open any bitmap files anywhere in your code ( jpg/png/etc ) ? That's usually where a problem causes the generic error.
 
Share this answer
 

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