I'm working in a windows forms project using visual studio 2005 sp1, i've a lot of usercontrol that use for my user interface, yesterday i start to have problem with the designmode, when i open a usercontrol all control disappear, i check the design file and the definition of the controls is still there, when i run the app there is no problem.
I try to use this code inside the Load of every usercontrol
if (!this.DesignMode)
{
// Put some logic here
}
however, the problem persist. Today my usercontrol doesn´t display in designmode but either in runtime.
How can be posible? Any suggestion for that?
Regards,
Francisco.
I've had the same problem. Check the .Designer.cs file again and make sure the controls which disappeared are added to their parent controls. Like
this.pCheck.Controls.Add(this.pCheck_bLog_browse);
While checking the differences with previous revisions I figured out that for some reason these lines just disappeared.
Related
VB.NET 2010 project, VS 2010, VSS (think it is 2008).
looking at other posts for this error, seems it is because of a change in a loop, enumeration, etc... In my case, all I do is open the project, make any change, like re-sizing the form, save and close and when I reopen that form I get this error. then I can undo checkout of the code and it opens fine. Not even making a change to any code, just re-size the form. ANY change I make, gets this error. The code is in production already and works fine, and I think it only happens on my pc.
Help! Thank you in advance...
adding - actually it looks like it only happens in changes in the form, and the error is only on the form, not the code. But it happens on any form.
A coworker figured it out for me. It was an issue with DevExpress windows controls and Visual Studio.
Solution is here:
How to enable visual inheritance for Developer Express controls.
I am facing something strange in my Visio Add-in:
I have a CommandBar, with CommandButtons on it and I just launch my debug mode.
The first page is OK (the start page of Visio) but if I open a file or create a new file, I can click all I want on my buttons, nothing is working !
It worked perfectly on the start page but not on my new visio file...
I tried to comment parts of my code, but the issue seems to come from nowhere... I really do not understand.
If someone already faced this kind of behaviour, please help, I just do not know what to do...
You could try setting ".Tag" property for your button to some unique value.
More info here:
http://msdn.microsoft.com/en-us/library/aa201791.aspx,
"Maintaining references to command bar controls when contexts change"
I've been searching, testing and trying a lot of things to create my project with Visual Studio 2010 Pro.
What I need is the same thing as Windows Form Application but ONLY in C++ (no managed stuff). So I guess I should be creating an MFC application. However, is there a way to design the main window? In the resources of the project, there are only the resources used by the main window, but it seems not possible to design (with the toolbox) the main window itself.
Am I missing something here? Anyone knows how to do this or point me to a good tutorial. I'm still searching for a solution, and I'll post it if I find it.
Thanks a lot!
You can either create a dialog-based app (as Hans wrote): The resource editor will let you add/move/size/configure controls to your dialog.
Or alternately, you can create a SDI MFC application and choose CFormView as the base class for the main view. This way, your main view (aka form) is a dialog that you can fill in using the resource editor the same way you would do with a dialog.
I am having a problem thats not about the code, it's about the screen in Microsoft visual studio 2008.
Actually problem is i created one utility from couple of weeks i didn't opened that utility today i opened (in Microsoft visual studio the screen appearing blank no controls are visible in that.But all the controls properties are there. I tried a lot but i didn't get solution. Last when the same thing happened i created the controls again. Now i don't want to go to create all the controls again. If any one have the solution please help me.
Before screen is like this:
Now its blank (like new page)
From your description I'm not sure if this is a application/code build issue or an IDE issue, what you could try is to reset the settings in visual studio and see if this helps.
You can do this by going to Tools -> Import/Export settings and then following the wizard to reset the settings, you may also want to perform a backup before resetting them (this is also part of the wizard) then they can be restored if this causes you further issues.
I don't have a copy of 2008 available at the moment so some menu entries may be slightly named different.
Hope this helps!
EDIT:
Now there is more information, this looks like there may be a problem with the code in the
InitializeComponent
method of the form.designer file (e.g. if you are using c# this would be something like Form1.Designer.cs and can be found by expanding the corresponding form in the solution explorer), if you remove/comment the lines that say
this.Controls.Add(this.NameOfControl)
(NameOfControl is where you would see your declared controls name)
then you get the behaviour that you are seeing, the controls do not render as they are never added to the forms controls collection but as they are declared you will still see them in the properties drop down and wont be able to add another control with the same name.
Is there a way to get Visual Studio 2008 to automatically change the the tool windows shown when changing from view to view?
Say i'm in the Code view, i may want the Solution Explorer and the Class View windows, but not the properties window. When i switch to Design view, i don't want the Solution Explorer or the Class view, but i want the Properties to come up. Can visual studio change these things for me instead of me doing it manually everytime i switch a view?
It seems like it would be an easy thing to know whether this feature exists or not, but i haven't been able to find anything about it. Maybe i'm using the wrong terminology.
Thanks to Hans for pointing me towards macros in his comment, and to pettys answer in this question i came up with a solution. The bulk of it is based off pettys' code but i added an event handler for the WindowActivated event where i decided what view i should load.
Private Sub WindowEvents_WindowActivated(ByVal GotFocus As EnvDTE.Window, ByVal LostFocus As EnvDTE.Window) Handles WindowEvents.WindowActivated
If GotFocus.Kind = "Document" Then
If GotFocus.Caption.Contains("[Design]") Then
LoadDesignView()
Else
LoadCodeView()
End If
End If
End Sub