views:

97

answers:

3

Hi,

I was creating a new form and my IDE crashed, or it was having problems, and now every time I create a new form it has a black line across it. The black line is not something I was adding, it appears to be the black line from the top of the form getting painted in the wrong place. The interesting thing is that every time I reload the form the line moves up until after the 5th load it disappears. How do I stop this happening? I have tried build, rebuild, clean solution (restart visual studio) but it is still there, it isn't consistent either which also annoying, any ideas?

screenshot of form with black line through it

+1  A: 

The way the line appears overtop of the window (it goes over the border) makes it look like it's probably outside of the Designer-generated code.

Some exploratory coding:

  1. Make a backup!
  2. Try commenting out as much code-behind as possible. Test if it recurs with only the designer-generated code.
    • if it doesn't, then slowly uncomment your code-behind. The highest-risk code is anything that either directly manipulates the Graphics system.
    • if it does, then try commenting out different control declarations until it goes away (you'll be tweaking generated code, so this is where a good backup is critical)

To help test, can you comment out any code-behind so that it's only the Designer-generated code and see if it still occurs?

STW
I did try this but nothing appears to correspond to the line.
flavour404
A: 

Do you have any Visual Studio add-in installed that might be interfering? Does this problem also happen when you create a new, clean, empty form? Or only for this specific form you attached? If only for this one, can you share the code?

Ran
A: 

If every time you go in design mode the line moves up it should be in the code behind in the Designer-generated code as mentioned above, If not try to look in Form_Initialize, If not check if you use a user-control(That is not one of vs standard, maybe one you wrote yourself) and do the same checks there (Could even be in the constructor of the user-control).

YanivH
Also try reset vs settings:Run "devenv.exe /resetsettings"
YanivH
The line does not show in the designer, only when the app is run.
flavour404