inheritance ribbonform to mainform

May 17, 2013 at 3:09 PM

using the next code for inheritance is not working for me in the new may release
public partial class Form1 : RibbonForm
is this a known issue? thanks for your help
May 17, 2013 at 3:13 PM
Edited May 17, 2013 at 3:14 PM
There is already a working inherited MDI Form available at download (10th May 2013).
If you still experiencing inheritance problem, try upload a sample project that creates the problem as you mentioned.
Please upload the sample at Issues section.
May 17, 2013 at 7:17 PM
What is not working for you? What is your problem?
May 18, 2013 at 12:28 AM
No idea, when I updated to the latest release I get this error
using public partial class Form1 : RibbonForm does not work for me I get the error otherwise it works but cant inherit

No se controló System.NullReferenceException
Message=Referencia a objeto no establecida como instancia de un objeto.
   en System.Windows.Forms.RibbonFormHelper.WndProc(Message& m)
   en System.Windows.Forms.RibbonForm.WndProc(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   en System.Windows.Forms.SafeNativeMethods.SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, Int32 x, Int32 y, Int32 cx, Int32 cy, Int32 flags)
   en System.Windows.Forms.Control.UpdateStylesCore()
   en System.Windows.Forms.Form.CreateHandle()
   en System.Windows.Forms.Control.get_Handle()
   en System.Windows.Forms.Control.SetVisibleCore(Boolean value)
   en System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   en System.Windows.Forms.Control.set_Visible(Boolean value)
   en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   en System.Windows.Forms.Application.Run(Form mainForm)
   en RoutingAssistantLS.Program.Main() en \\psf\home\Documents\Visual Studio 2010\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Program.cs:línea 20
   en System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   en System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   en System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   en System.Threading.ThreadHelper.ThreadStart()
May 18, 2013 at 3:52 AM
Edited May 18, 2013 at 3:53 AM
When ribbon control is added into a form, some codes will initially be created at form controls initialization, the form designer.
Form that uses old ribbon control cannot be migrated directly to new ribbon control.
This is because the new ribbon handle the form differently with the old ribbon.
Therefore, to resolve this problem, I can suggest 2 ways.

1st way: Remove the designer's codes in form designer which is not needed by new ribbon.
You can create a new form with inheritance of new RibbonForm. Then, you compare the designer code of new form with your current mainform (which uses the old ribbon). Remove any incompatible designer codes. However, there are lots of codes related to Ribbon control, this will take you some time to search through the designer codes line by line.

2nd way: Recreate the MainForm with inheritance of new RibbonForm.
May 18, 2013 at 8:00 AM
Is this a runtime or design time problem?
May 18, 2013 at 3:03 PM
It only happens at runtime
May 21, 2013 at 8:32 AM
I can see that the error (NullReferenceException) is happening in the RibbonFormHelper.WndProc but that is not enough.

Can you run it from VS and tell us in which line it exactly happens? Also the InnerException would be nice to see.
May 21, 2013 at 5:24 PM
thanks to both, I followed adriancs advice its working now