Throwing errors while changing Ui design
I have a Datagrid , 2 textBoxes and 4 buttons whenever I change positions or add a new controls , It gives errors form my grid variable saying it is not in current context . I am creating a window Applica开发者_高级运维tion and using WinForms. I dont use any threads to Design
It sounds like you may be running into a pretty common issue. ..
The designer will execute any code found in the constructor and, if IIRC, the Load event.
Simple way to do this without rearranging all your code to guard any code that isn't purely (and I mean purely) layout code with a check to the form or control's DesignMode property...
if(!DesignMode)
{
//your code
}
As Scoregraphic asks are you performing this manipulation within a separate thread?
精彩评论