Menu

Form design with generic WinFormsView

Help
graydo64
2009-03-27
2013-04-26
  • graydo64

    graydo64 - 2009-03-27

    Firstly thanks for MVC# - it's a fantastic set of libraries.

    I'm having an issue when creating windows forms inheriting from WinFormsView<T> in that I can't use the visual forms designer - I get the following error:

    "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: OnSiteForm --- The base class 'MVCSharp.Winforms.WinFormView' could not be loaded. Ensure the assembly has been referenced and that all projects have been built. "

    However, if I inherit from WinFormsView the designer works as expected.  I could just use the simple WinFormsView but it makes my code more lengthy and I'd prefer to use the generic version.  Is this an issue that you've come across before - am I missing something, an attribute perhaps?  Any help appreciated!

    Sample code below:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using MVCSharp.Winforms;
    using MVCSharp.Winforms.Configuration;
    using <mynamespace>.ApplicationLogic.Views;
    using <mynamespace>.ApplicationLogic.Tasks;
    using <mynamespace>.ApplicationLogic.Controllers;

    namespace <mynamespace>.WinClient
    {
        [WinformsViewAttribute(typeof(RegistrationTask), "OnSiteForm Form")]
        public partial class OnSiteForm : WinFormView<OnSiteViewController>
        {
            public OnSiteForm()
            {
                InitializeComponent();
            }
        }
    }

     
    • graydo64

      graydo64 - 2009-03-27

      Sorry - should have pointed out that I'm using Visual Studio Professional 2008 SP1!

       
    • OVZH

      OVZH - 2009-03-28

      Hi,

      Thank you for your appreciation!

      Take a look at the Basics (generics used) example. There an intermediate empty parent class is used to make the designer behave correctly. This is due to a known bug in the VS forms designer.

      Regards,
      --
      Oleg Zhukov

       
    • graydo64

      graydo64 - 2009-03-30

      Superb!  Thanks for your help Oleg and keep up the good work!!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.