How to write a control that doesn't require a closing tag

P

Paul

Hi all,

I've built a custom control that won't contain any inner content. If I
derive the control from Control, then the VS editor will always add the
closing tag when I use the control. I can derive from UserControl and
it doesn't do this, but I'm not sure whether is the best way to do
this.

What is the correct way to make a control that is self-closing (i.e.
doesn't have a closing tag)?

Thanks,

Paul
 
S

Sean Chambers

If you dont want to use a closing tag you can use a />

ie:

<MyCompany:UserControl id="something" text="blah" />

Is that what you mean?

Sean
 
P

Paul

Hi Sean,

I know you can do that, but I'd like to know what the recommended way
of writing controls that the form designer knows don't need closing
tags - i.e. when you complete the opening tag it self-closes the
opening tag with "/>".

Thanks,

Paul
 
J

Jason Kester

Paul said:
I know you can do that, but I'd like to know what the recommended way
of writing controls that the form designer knows don't need closing
tags - i.e. when you complete the opening tag it self-closes the
opening tag with "/>".

Ah, so your request, restated, is this:

"Hey Microsoft! Please spend the several thousand man hours required
to spec, approve, implement, test, document and release a new version
of Visual Studio.NET so that I will occasionally be saved a single
keystroke."

I hate to dissapoint, but it looks like you'll just have to work on
your pinky-ring finger dexterity a bit.


Jason Kester
Expat Software Consulting Services
http://www.expatsoftware.com/
 
P

Paul

I didn't think it was an outrageous question, but if you want to be a
tool, be my guest.

Paul
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top