Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. can't design UserControl

can't design UserControl

Scheduled Pinned Locked Moved Visual Studio
helpquestioncsharpdotnetvisual-studio
3 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    moredip
    wrote on last edited by
    #1

    **CROSSPOSTED TO .NET FRAMEWORK FORUM** Hi all, I've got a class called RowView derived from UserControl, which is itself the parent of another class (AuthorView). RowView has a public property Data. Since RowView should never be instantiated directly (it's a pseudo-abstract class) it doesn't implement Data, it simply throws a NotSupportedException. My AuthorView class does implement Data. Now my problem is that whenever I try and 'design' AuthorView in VS .NET the designer tries to access RowView.Data, which throws an exception. So my question is, how do I stop VS .NET's designer from attempting to access Data. I've tried settig the Browsable attribute to false in RowView.Data, but it doesn't help. I can post up some code if that'll help clarify the situation. TIA, Pete

    N 1 Reply Last reply
    0
    • M moredip

      **CROSSPOSTED TO .NET FRAMEWORK FORUM** Hi all, I've got a class called RowView derived from UserControl, which is itself the parent of another class (AuthorView). RowView has a public property Data. Since RowView should never be instantiated directly (it's a pseudo-abstract class) it doesn't implement Data, it simply throws a NotSupportedException. My AuthorView class does implement Data. Now my problem is that whenever I try and 'design' AuthorView in VS .NET the designer tries to access RowView.Data, which throws an exception. So my question is, how do I stop VS .NET's designer from attempting to access Data. I've tried settig the Browsable attribute to false in RowView.Data, but it doesn't help. I can post up some code if that'll help clarify the situation. TIA, Pete

      N Offline
      N Offline
      Natty Gur
      wrote on last edited by
      #2

      You can use the Site.DesignMode to stop VS .NET's designer from attempting to access Data.

      M 1 Reply Last reply
      0
      • N Natty Gur

        You can use the Site.DesignMode to stop VS .NET's designer from attempting to access Data.

        M Offline
        M Offline
        moredip
        wrote on last edited by
        #3

        Do you mean something along the lines of:

        public property object Data
        {
        get
        {
        if( !DesignMode )
        throw new NotSupportedException();
        else
        return null;
        }
        }

        Is that the only way to solve this problem? I don't really like the idea of having little if( !DesignMode ) lines all over my code :| But thanks for the help :)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups