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

N

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.
 
J

Jesse Houwing

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.
 
N

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
(e-mail address removed)
http://www.nathansokalski.com/

Jesse Houwing said:
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.
 
F

Family Tree Mike

Nathan Sokalski said:
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
(e-mail address removed)
http://www.nathansokalski.com/

Jesse Houwing said:
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.


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.
 
N

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
(e-mail address removed)
http://www.nathansokalski.com/

Family Tree Mike said:
Nathan Sokalski said:
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
(e-mail address removed)
http://www.nathansokalski.com/

Jesse Houwing said:
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.


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.
 
F

Family Tree Mike

Nathan Sokalski said:
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
(e-mail address removed)
http://www.nathansokalski.com/

Family Tree Mike said:
Nathan Sokalski said:
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
(e-mail address removed)
http://www.nathansokalski.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.


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.


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.
 
J

Jesse Houwing

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.
 
N

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
(e-mail address removed)
http://www.nathansokalski.com/

Jesse Houwing said:
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.
 
J

Jesse Houwing

Hello Nathan,

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

Jesse
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.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top