Inheritance Base Form lock
I am using a base form which has menu and toolbar in a windows forms application. I changed modifier property all the toolbar items and menu items to protected. The other forms inherits the base form.
I can see the controls on my inherited form but can't click on any button on toolbar or menu and neither I can write code for events for the controls on base form.
It used to work on Beta1; now the inherited form shows the small lock on the controls of base form.
I can write code for the events of toolbar/menu and code compiles but I can't double-click on the control to write code.
I also tried with modifier as public but still same issue.
Is this a bug?
Thanks...
[692 byte] By [
gulatis] at [2007-12-16]
I do not think this is a bug because It works just fine for me. I would post the code but its geting late and I do not want to write it out again :) So here is a link to the
actual solutionI just made two forms one with a some controls on them.. I do notice that menu items do not show up on my second form and I think this is by design because most menu Items are global... I mean a file open does the same thought out the application no matter what form its on. You can double click on code against things like buttons etcc on the second form. I see where your coming from but I think its suppose to be that way. I hope my little bit of code there helps
| 
| One or more errors encountered while loading the designer. The errors are listed below. Some errors can be fixed by rebuilding your project, while others may require code changes. Clicking on each error will take you to the line of code that caused it. |
| The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: Form2 The base class 'WindowsApplication1.Form1' could not be loaded. Ensure the assembly has been referenced and compiled. Hide |
| at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.EnsureDocument(IDesignerSerializationManager manager) at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)
|
Getting this error while opening form2 in design mode.
further, I am creating base form and referencing base form assembly in inherited form assembly. I am also adding inherited form by selecting Add inherited form. Also I am using VB.NET.
The toolbar feature has been disabled by Microsoft within an inherited base form. They had a bug with the binding so they locked the controls within the toolbar in the beta 2 version. This feature will be added sometime in the future but it will not be in the first release of ".Net 2005".
The way to get around the problem is to use the "AddHandler , AddressOf" on the form load.
Example:
Public Class MyForm
Inherits BaseForm Private Sub MyForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
setEventHandlers()
End Sub Private
Sub setEventHandlers()
AddHandler BaseSaveButton.Click, AddressOf BaseSaveButton_Click 'Bug in DOT NET you have to add the event this way
End Sub Private Sub BaseSaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End SubI hope this helps.