Home All Groups Group Topic Archive Search About

Visual Studio 2008 and Classes Inheriting From System.Web.UI.WebControls.Style

Author
22 May 2009 2:43 AM
Nathan Sokalski
I have a class written in Visual Basic that inherits from
System.Web.UI.WebControls.Style. The file looks just like any other VB class
I wrote, it is simple a text file with a name of the format *.vb. However,
the Solution Explorer in Visual Studio 2008 displays it with a different
icon and when I double click the file to edit it, the tab opened by Visual
Studio 2008 has a title of:

myfilename.vb [Design]

And displays the text:

To add components to your class, drag them from the ToolBox and use the
Properties window to set their properties. To create methods and events for
your class, click here to switch to code view.

I can obviously click on "click here to switch to code view" or right click
the file in Solution Explorer and select "View Code" to edit the code in the
file, so I am not being restricted from editing the code using Visual Studio
2008. However, it is a pain in the neck to need to use a different method to
open a file that is of the same type as all the others. Why is Visual Studio
2008 treating this file differently? Any help would be appreciated. Thanks.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Author
22 May 2009 10:12 AM
Jesse Houwing
Hello Nathan,

Show quoteHide quote
> I have a class written in Visual Basic that inherits from
> System.Web.UI.WebControls.Style. The file looks just like any other VB
> class I wrote, it is simple a text file with a name of the format
> *.vb. However, the Solution Explorer in Visual Studio 2008 displays it
> with a different icon and when I double click the file to edit it, the
> tab opened by Visual Studio 2008 has a title of:
>
> myfilename.vb [Design]
>
> And displays the text:
>
> To add components to your class, drag them from the ToolBox and use
> the Properties window to set their properties. To create methods and
> events for your class, click here to switch to code view.
>
> I can obviously click on "click here to switch to code view" or right
> click the file in Solution Explorer and select "View Code" to edit the
> code in the file, so I am not being restricted from editing the code
> using Visual Studio 2008. However, it is a pain in the neck to need to
> use a different method to open a file that is of the same type as all
> the others. Why is Visual Studio 2008 treating this file differently?
> Any help would be appreciated. Thanks.

It is detected to be a designable file, and as such, Visual Studio opens
the designer. You can press F7 in the designer to switch to the code window.
That is usually the fastest way. Just doubleclick and press F7.


--
Jesse Houwing
jesse.houwing at sogeti.nl
Author
22 May 2009 9:15 PM
Nathan Sokalski
I know how to switch to Code View, including using F7, that was never my
problem or question. My question is why is this *.vb file being treated
differently than others? How exactly is it a designable file? It is a VB
class that inherits from another class. Files such as *.aspx and *.master
are designable, because they can be displayed visually (as something other
than code), but this file cannot be displayed as anything other than code.
Also, the tab that opens when I double click it in Solution Explorer does
not display anything that can be edited, it just displays the text I
mentioned in my original post; all you can do in the tab that is opened is
click the appropriate part of that text to change to code view. In other
words, I don't think there even is such a thing as Design View for *.vb
files. What would be in the Design View for *.vb files? Visual Studio 2008
has utilities for certain parts of code that can be used, but those are
separate windows or tabs, not Views. So I still don't understand why this
*.vb file is being treated differently from other *.vb files. Any ideas?
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"Jesse Houwing" <jesse.houwing@newsgroup.nospam> wrote in message
news:e5317a7e7800b2a68cba8edaa8a6a05@news.microsoft.com...
> Hello Nathan,
>
>> I have a class written in Visual Basic that inherits from
>> System.Web.UI.WebControls.Style. The file looks just like any other VB
>> class I wrote, it is simple a text file with a name of the format
>> *.vb. However, the Solution Explorer in Visual Studio 2008 displays it
>> with a different icon and when I double click the file to edit it, the
>> tab opened by Visual Studio 2008 has a title of:
>>
>> myfilename.vb [Design]
>>
>> And displays the text:
>>
>> To add components to your class, drag them from the ToolBox and use
>> the Properties window to set their properties. To create methods and
>> events for your class, click here to switch to code view.
>>
>> I can obviously click on "click here to switch to code view" or right
>> click the file in Solution Explorer and select "View Code" to edit the
>> code in the file, so I am not being restricted from editing the code
>> using Visual Studio 2008. However, it is a pain in the neck to need to
>> use a different method to open a file that is of the same type as all
>> the others. Why is Visual Studio 2008 treating this file differently?
>> Any help would be appreciated. Thanks.
>
> It is detected to be a designable file, and as such, Visual Studio opens
> the designer. You can press F7 in the designer to switch to the code
> window. That is usually the fastest way. Just doubleclick and press F7.
>
>
> --
> Jesse Houwing
> jesse.houwing at sogeti.nl
>
>
Author
22 May 2009 9:50 PM
Family Tree Mike
Show quote Hide quote
"Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
news:evkxBKy2JHA.1424@TK2MSFTNGP02.phx.gbl...
>I know how to switch to Code View, including using F7, that was never my
>problem or question. My question is why is this *.vb file being treated
>differently than others? How exactly is it a designable file? It is a VB
>class that inherits from another class. Files such as *.aspx and *.master
>are designable, because they can be displayed visually (as something other
>than code), but this file cannot be displayed as anything other than code.
>Also, the tab that opens when I double click it in Solution Explorer does
>not display anything that can be edited, it just displays the text I
>mentioned in my original post; all you can do in the tab that is opened is
>click the appropriate part of that text to change to code view. In other
>words, I don't think there even is such a thing as Design View for *.vb
>files. What would be in the Design View for *.vb files? Visual Studio 2008
>has utilities for certain parts of code that can be used, but those are
>separate windows or tabs, not Views. So I still don't understand why this
>*.vb file is being treated differently from other *.vb files. Any ideas?
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
> "Jesse Houwing" <jesse.houwing@newsgroup.nospam> wrote in message
> news:e5317a7e7800b2a68cba8edaa8a6a05@news.microsoft.com...
>> Hello Nathan,
>>
>>> I have a class written in Visual Basic that inherits from
>>> System.Web.UI.WebControls.Style. The file looks just like any other VB
>>> class I wrote, it is simple a text file with a name of the format
>>> *.vb. However, the Solution Explorer in Visual Studio 2008 displays it
>>> with a different icon and when I double click the file to edit it, the
>>> tab opened by Visual Studio 2008 has a title of:
>>>
>>> myfilename.vb [Design]
>>>
>>> And displays the text:
>>>
>>> To add components to your class, drag them from the ToolBox and use
>>> the Properties window to set their properties. To create methods and
>>> events for your class, click here to switch to code view.
>>>
>>> I can obviously click on "click here to switch to code view" or right
>>> click the file in Solution Explorer and select "View Code" to edit the
>>> code in the file, so I am not being restricted from editing the code
>>> using Visual Studio 2008. However, it is a pain in the neck to need to
>>> use a different method to open a file that is of the same type as all
>>> the others. Why is Visual Studio 2008 treating this file differently?
>>> Any help would be appreciated. Thanks.
>>
>> It is detected to be a designable file, and as such, Visual Studio opens
>> the designer. You can press F7 in the designer to switch to the code
>> window. That is usually the fastest way. Just doubleclick and press F7.
>>
>>
>> --
>> Jesse Houwing
>> jesse.houwing at sogeti.nl
>>
>>
>
>


This is not happening for me, though I am using Web Developer Express 2008.
Could there be something in your class that causes this?  As a check, if you
simply make a blank vb class that inherits from your parent class, does this
issue occur?  If not, then paste the "guts" of the class into this new class
and see if the behaviour changes.

--
Mike
Author
23 May 2009 1:29 AM
Nathan Sokalski
Here are two test classes I made, Class1.vb and Class2.vb. You will notice
that the only difference between them is that Class1 inherits from
System.Web.UI.WebControls.Style while Class2 is simply an empty class:

Class1.vb:

Public Class Class1 : Inherits System.Web.UI.WebControls.Style
End Class


Class2.vb:

Public Class Class2
End Class


Class1 has the different icon and double clicking it opens it in Design
View, while Class2 does all the usual, normal, expected stuff. This pretty
much proves that it is inheriting from System.Web.UI.WebControls.Style that
causes what is happening. And even though I think (and want) all *.vb files
to open in Code View, if there was a Design View for *.vb files that inherit
from certain classes that allowed you to make changes (double clicking
*.aspx and *.master files opens them in Design View, but I have no problem
with that since that is one of the ways to edit those files), I would be
willing to accept that Visual Studio 2008 likes to open them in that Design
View. However, the tab that is opened when you double click files that
inherit from System.Web.UI.WebControls.Style does not provide any way of
editing (or even viewing) the file, so I don't see any point in that tab
ever being opened to begin with, since it has no purpose. I really don't
know why this is not happening for you in Web Developer Express 2008, I
guess it's just one of those small differences between the two.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"Family Tree Mike" <FamilyTreeM***@ThisOldHouse.com> wrote in message
news:A8B5C7EE-1DF7-4BF9-B2BD-790150AB5E60@microsoft.com...
> "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
> news:evkxBKy2JHA.1424@TK2MSFTNGP02.phx.gbl...
>>I know how to switch to Code View, including using F7, that was never my
>>problem or question. My question is why is this *.vb file being treated
>>differently than others? How exactly is it a designable file? It is a VB
>>class that inherits from another class. Files such as *.aspx and *.master
>>are designable, because they can be displayed visually (as something other
>>than code), but this file cannot be displayed as anything other than code.
>>Also, the tab that opens when I double click it in Solution Explorer does
>>not display anything that can be edited, it just displays the text I
>>mentioned in my original post; all you can do in the tab that is opened is
>>click the appropriate part of that text to change to code view. In other
>>words, I don't think there even is such a thing as Design View for *.vb
>>files. What would be in the Design View for *.vb files? Visual Studio 2008
>>has utilities for certain parts of code that can be used, but those are
>>separate windows or tabs, not Views. So I still don't understand why this
>>*.vb file is being treated differently from other *.vb files. Any ideas?
>> --
>> Nathan Sokalski
>> njsokal***@hotmail.com
>> http://www.nathansokalski.com/
>>
>> "Jesse Houwing" <jesse.houwing@newsgroup.nospam> wrote in message
>> news:e5317a7e7800b2a68cba8edaa8a6a05@news.microsoft.com...
>>> Hello Nathan,
>>>
>>>> I have a class written in Visual Basic that inherits from
>>>> System.Web.UI.WebControls.Style. The file looks just like any other VB
>>>> class I wrote, it is simple a text file with a name of the format
>>>> *.vb. However, the Solution Explorer in Visual Studio 2008 displays it
>>>> with a different icon and when I double click the file to edit it, the
>>>> tab opened by Visual Studio 2008 has a title of:
>>>>
>>>> myfilename.vb [Design]
>>>>
>>>> And displays the text:
>>>>
>>>> To add components to your class, drag them from the ToolBox and use
>>>> the Properties window to set their properties. To create methods and
>>>> events for your class, click here to switch to code view.
>>>>
>>>> I can obviously click on "click here to switch to code view" or right
>>>> click the file in Solution Explorer and select "View Code" to edit the
>>>> code in the file, so I am not being restricted from editing the code
>>>> using Visual Studio 2008. However, it is a pain in the neck to need to
>>>> use a different method to open a file that is of the same type as all
>>>> the others. Why is Visual Studio 2008 treating this file differently?
>>>> Any help would be appreciated. Thanks.
>>>
>>> It is detected to be a designable file, and as such, Visual Studio opens
>>> the designer. You can press F7 in the designer to switch to the code
>>> window. That is usually the fastest way. Just doubleclick and press F7.
>>>
>>>
>>> --
>>> Jesse Houwing
>>> jesse.houwing at sogeti.nl
>>>
>>>
>>
>>
>
>
> This is not happening for me, though I am using Web Developer Express
> 2008. Could there be something in your class that causes this?  As a
> check, if you simply make a blank vb class that inherits from your parent
> class, does this issue occur?  If not, then paste the "guts" of the class
> into this new class and see if the behaviour changes.
>
> --
> Mike
Author
23 May 2009 2:13 AM
Family Tree Mike
Show quote Hide quote
"Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
news:ubvfbX02JHA.1372@TK2MSFTNGP05.phx.gbl...
> Here are two test classes I made, Class1.vb and Class2.vb. You will notice
> that the only difference between them is that Class1 inherits from
> System.Web.UI.WebControls.Style while Class2 is simply an empty class:
>
> Class1.vb:
>
> Public Class Class1 : Inherits System.Web.UI.WebControls.Style
> End Class
>
>
> Class2.vb:
>
> Public Class Class2
> End Class
>
>
> Class1 has the different icon and double clicking it opens it in Design
> View, while Class2 does all the usual, normal, expected stuff. This pretty
> much proves that it is inheriting from System.Web.UI.WebControls.Style
> that causes what is happening. And even though I think (and want) all *.vb
> files to open in Code View, if there was a Design View for *.vb files that
> inherit from certain classes that allowed you to make changes (double
> clicking *.aspx and *.master files opens them in Design View, but I have
> no problem with that since that is one of the ways to edit those files), I
> would be willing to accept that Visual Studio 2008 likes to open them in
> that Design View. However, the tab that is opened when you double click
> files that inherit from System.Web.UI.WebControls.Style does not provide
> any way of editing (or even viewing) the file, so I don't see any point in
> that tab ever being opened to begin with, since it has no purpose. I
> really don't know why this is not happening for you in Web Developer
> Express 2008, I guess it's just one of those small differences between the
> two.
> --
> Nathan Sokalski
> njsokal***@hotmail.com
> http://www.nathansokalski.com/
>
> "Family Tree Mike" <FamilyTreeM***@ThisOldHouse.com> wrote in message
> news:A8B5C7EE-1DF7-4BF9-B2BD-790150AB5E60@microsoft.com...
>> "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message
>> news:evkxBKy2JHA.1424@TK2MSFTNGP02.phx.gbl...
>>>I know how to switch to Code View, including using F7, that was never my
>>>problem or question. My question is why is this *.vb file being treated
>>>differently than others? How exactly is it a designable file? It is a VB
>>>class that inherits from another class. Files such as *.aspx and *.master
>>>are designable, because they can be displayed visually (as something
>>>other than code), but this file cannot be displayed as anything other
>>>than code. Also, the tab that opens when I double click it in Solution
>>>Explorer does not display anything that can be edited, it just displays
>>>the text I mentioned in my original post; all you can do in the tab that
>>>is opened is click the appropriate part of that text to change to code
>>>view. In other words, I don't think there even is such a thing as Design
>>>View for *.vb files. What would be in the Design View for *.vb files?
>>>Visual Studio 2008 has utilities for certain parts of code that can be
>>>used, but those are separate windows or tabs, not Views. So I still don't
>>>understand why this *.vb file is being treated differently from other
>>>*.vb files. Any ideas?
>>> --
>>> Nathan Sokalski
>>> njsokal***@hotmail.com
>>> http://www.nathansokalski.com/
>>>
>>> "Jesse Houwing" <jesse.houwing@newsgroup.nospam> wrote in message
>>> news:e5317a7e7800b2a68cba8edaa8a6a05@news.microsoft.com...
>>>> Hello Nathan,
>>>>
>>>>> I have a class written in Visual Basic that inherits from
>>>>> System.Web.UI.WebControls.Style. The file looks just like any other VB
>>>>> class I wrote, it is simple a text file with a name of the format
>>>>> *.vb. However, the Solution Explorer in Visual Studio 2008 displays it
>>>>> with a different icon and when I double click the file to edit it, the
>>>>> tab opened by Visual Studio 2008 has a title of:
>>>>>
>>>>> myfilename.vb [Design]
>>>>>
>>>>> And displays the text:
>>>>>
>>>>> To add components to your class, drag them from the ToolBox and use
>>>>> the Properties window to set their properties. To create methods and
>>>>> events for your class, click here to switch to code view.
>>>>>
>>>>> I can obviously click on "click here to switch to code view" or right
>>>>> click the file in Solution Explorer and select "View Code" to edit the
>>>>> code in the file, so I am not being restricted from editing the code
>>>>> using Visual Studio 2008. However, it is a pain in the neck to need to
>>>>> use a different method to open a file that is of the same type as all
>>>>> the others. Why is Visual Studio 2008 treating this file differently?
>>>>> Any help would be appreciated. Thanks.
>>>>
>>>> It is detected to be a designable file, and as such, Visual Studio
>>>> opens the designer. You can press F7 in the designer to switch to the
>>>> code window. That is usually the fastest way. Just doubleclick and
>>>> press F7.
>>>>
>>>>
>>>> --
>>>> Jesse Houwing
>>>> jesse.houwing at sogeti.nl
>>>>
>>>>
>>>
>>>
>>
>>
>> This is not happening for me, though I am using Web Developer Express
>> 2008. Could there be something in your class that causes this?  As a
>> check, if you simply make a blank vb class that inherits from your parent
>> class, does this issue occur?  If not, then paste the "guts" of the class
>> into this new class and see if the behaviour changes.
>>
>> --
>> Mike
>
>


Just to put the information out there if someone else can help, I too see
the difference in the icon when inheriting from
System.Web.UI.WebControls.Style.  I'm not really sure what that icon means.

--
Mike
Author
23 May 2009 10:19 PM
Jesse Houwing
Hello Jesse,

Show quoteHide quote
> Hello Nathan,
>
>> I have a class written in Visual Basic that inherits from
>> System.Web.UI.WebControls.Style. The file looks just like any other
>> VB class I wrote, it is simple a text file with a name of the format
>> *.vb. However, the Solution Explorer in Visual Studio 2008 displays
>> it with a different icon and when I double click the file to edit it,
>> the tab opened by Visual Studio 2008 has a title of:
>>
>> myfilename.vb [Design]
>>
>> And displays the text:
>>
>> To add components to your class, drag them from the ToolBox and use
>> the Properties window to set their properties. To create methods and
>> events for your class, click here to switch to code view.
>>
>> I can obviously click on "click here to switch to code view" or right
>> click the file in Solution Explorer and select "View Code" to edit
>> the code in the file, so I am not being restricted from editing the
>> code using Visual Studio 2008. However, it is a pain in the neck to
>> need to use a different method to open a file that is of the same
>> type as all the others. Why is Visual Studio 2008 treating this file
>> differently? Any help would be appreciated. Thanks.
>>
> It is detected to be a designable file, and as such, Visual Studio
> opens the designer. You can press F7 in the designer to switch to the
> code window. That is usually the fastest way. Just doubleclick and
> press F7.


Any class inheriting from Component (driectly or indirectly) is shown in
the designer. It's just the way it works.

--
Jesse Houwing
jesse.houwing at sogeti.nl
Author
24 May 2009 1:36 AM
Nathan Sokalski
OK, I guess that explains why Visual Studio 2008 is doing what it's doing,
but it still doesn't answer my question as to why Visual Studio 2008 was
designed to do this. The tab that is opened doesn't let you do any designing
(the tab has no functionality other than clicking to change to Code View),
so is it really a Design View? Like I said in another post in this thread,
what is the reason for this tab ever being opened at all? Thanks.
--
Nathan Sokalski
njsokal***@hotmail.com
http://www.nathansokalski.com/

Show quoteHide quote
"Jesse Houwing" <jesse.houwing@newsgroup.nospam> wrote in message
news:e5317a7e7800b6558cbaa1c6bfa4082@news.microsoft.com...
> Hello Jesse,
>
>> Hello Nathan,
>>
>>> I have a class written in Visual Basic that inherits from
>>> System.Web.UI.WebControls.Style. The file looks just like any other
>>> VB class I wrote, it is simple a text file with a name of the format
>>> *.vb. However, the Solution Explorer in Visual Studio 2008 displays
>>> it with a different icon and when I double click the file to edit it,
>>> the tab opened by Visual Studio 2008 has a title of:
>>>
>>> myfilename.vb [Design]
>>>
>>> And displays the text:
>>>
>>> To add components to your class, drag them from the ToolBox and use
>>> the Properties window to set their properties. To create methods and
>>> events for your class, click here to switch to code view.
>>>
>>> I can obviously click on "click here to switch to code view" or right
>>> click the file in Solution Explorer and select "View Code" to edit
>>> the code in the file, so I am not being restricted from editing the
>>> code using Visual Studio 2008. However, it is a pain in the neck to
>>> need to use a different method to open a file that is of the same
>>> type as all the others. Why is Visual Studio 2008 treating this file
>>> differently? Any help would be appreciated. Thanks.
>>>
>> It is detected to be a designable file, and as such, Visual Studio
>> opens the designer. You can press F7 in the designer to switch to the
>> code window. That is usually the fastest way. Just doubleclick and
>> press F7.
>
>
> Any class inheriting from Component (driectly or indirectly) is shown in
> the designer. It's just the way it works.
>
> --
> Jesse Houwing
> jesse.houwing at sogeti.nl
>
>
Author
24 May 2009 9:43 AM
Jesse Houwing
Hello Nathan,

You could drag components on it from the toolbox. Not very useful for the
style class I know....

Jesse

Show quoteHide quote
> OK, I guess that explains why Visual Studio 2008 is doing what it's
> doing, but it still doesn't answer my question as to why Visual Studio
> 2008 was designed to do this. The tab that is opened doesn't let you
> do any designing (the tab has no functionality other than clicking to
> change to Code View), so is it really a Design View? Like I said in
> another post in this thread, what is the reason for this tab ever
> being opened at all? Thanks.
>
> "Jesse Houwing" <jesse.houwing@newsgroup.nospam> wrote in message
> news:e5317a7e7800b6558cbaa1c6bfa4082@news.microsoft.com...
>
>> Hello Jesse,
>>
>>> Hello Nathan,
>>>
>>>> I have a class written in Visual Basic that inherits from
>>>> System.Web.UI.WebControls.Style. The file looks just like any other
>>>> VB class I wrote, it is simple a text file with a name of the
>>>> format *.vb. However, the Solution Explorer in Visual Studio 2008
>>>> displays it with a different icon and when I double click the file
>>>> to edit it, the tab opened by Visual Studio 2008 has a title of:
>>>>
>>>> myfilename.vb [Design]
>>>>
>>>> And displays the text:
>>>>
>>>> To add components to your class, drag them from the ToolBox and use
>>>> the Properties window to set their properties. To create methods
>>>> and events for your class, click here to switch to code view.
>>>>
>>>> I can obviously click on "click here to switch to code view" or
>>>> right click the file in Solution Explorer and select "View Code" to
>>>> edit the code in the file, so I am not being restricted from
>>>> editing the code using Visual Studio 2008. However, it is a pain in
>>>> the neck to need to use a different method to open a file that is
>>>> of the same type as all the others. Why is Visual Studio 2008
>>>> treating this file differently? Any help would be appreciated.
>>>> Thanks.
>>>>
>>> It is detected to be a designable file, and as such, Visual Studio
>>> opens the designer. You can press F7 in the designer to switch to
>>> the code window. That is usually the fastest way. Just doubleclick
>>> and press F7.
>>>
>> Any class inheriting from Component (driectly or indirectly) is shown
>> in the designer. It's just the way it works.
>>
>> --
>> Jesse Houwing
>> jesse.houwing at sogeti.nl
--
Jesse Houwing
jesse.houwing at sogeti.nl