Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 12th, 2004, 04:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default VB.NET property descriptions

Hello,

When creating custom controls, how do you provide a default value and a description for a property in your control that you can see in Visual Studio .NET when the property is selected? I have seen that you can do it through the ComponentModel class, but is this the only way? If so, is there something special you have to be concerned with with that class? I remember trying to use it before, but had problems with it. This was a long time ago though...

I'm writing an ASP.NET control using VB.NET syntax.

Thanks,

Brian Mains
__________________
Brian
 
Old February 12th, 2004, 04:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

vb file:
---------------------
Imports System
Imports System.Web
Imports System.Web.UI

Namespace myControls

Public Class ShowColor: Inherits Control

Public Text As String
Public Color As String

Protected Overrides Sub Render( objTextWriter As HtmlTextWriter )
objTextWriter.AddAttribute( "Color", Color )
objTextWriter.RenderBeginTag( "Font" )
objTextWriter.Write( Text )
objTextWriter.RenderEndTag()
End Sub

End Class

End Namespace
---------------


HTML page:
<%@ Register TagPrefix="myControls" Namespace="myControls"
Assembly="ShowColor"%>

<html>
<head><title>DisplayShowColor.aspx</title></head>
<body>

<myControls:ShowColor
Text="Hello World!"
Color="Red"
Runat="Server" />

</body>
</html>



This is a very simple example but you should get the idea.
 
Old February 17th, 2004, 02:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I was thinking more along the lines of how the System.ComponentModel namespace would allow you to do:
Code:
<...  Description:="a description"...>
Property Text As String
...
That's what I was looking for was an alternative way to do this outside the ComponentModel, or if I have to use the component model, are there any special considerations that I need to be aware of? I remember having problems with this class before.

Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Template descriptions SoC Dreamweaver (all versions) 1 December 6th, 2004 04:47 PM
Adding descriptions to values in functions katsarosj VB.NET 5 August 17th, 2004 03:47 PM
The Instancing Property of VB Classes ejan VB Components 1 June 25th, 2004 04:56 PM
Codes to Add Descriptions to Data phungleon SQL Server 2000 6 June 4th, 2004 04:27 AM
Import Field Descriptions Mitch SQL Server 2000 0 September 15th, 2003 02:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.