Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 2nd, 2004, 12:59 PM
Authorized User
 
Join Date: Dec 2003
Location: , , .
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DolphinBay
Default Adding controls to Toolbox results in two entries

Good morning,

I just completed creating my first custom server control and am trying to add it to the toolbox. My question/problem is when I browse to where the DLL is located on the server and click Add, it is adding almost two identical entries. One has the namespace listed and the other has a blank namespace in the Customize Toolbox dialog box.

When I try to drag and drop the control without the namespace listed I get an error.

Any ideas why these two entries are being added each time I add a new control?

Thanks in advance.


Dolphin Bay, Inc. -- turning visions into eReality(tm) -- West Palm Beach, FL
Website Design, Internet Strategy, Search Engine Marketing

www.DolphinBay.biz
Reply With Quote
  #2 (permalink)  
Old April 2nd, 2004, 01:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Do they both have the same version number also? Check on that...
Reply With Quote
  #3 (permalink)  
Old April 2nd, 2004, 03:45 PM
Authorized User
 
Join Date: Dec 2003
Location: , , .
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DolphinBay
Default

Yes... both controls are exactly the same minus the namespace being empty on one of them. I click on the DLL to add it and both appear in the customize toolbar dialog. Both version numbers of 0.0.0.0 (retail)

Here is the command line I used:
vbc /t:library /r:System.dll,System.Web.dll ColorAccessor.vb

and here is the code from the VB file:
Imports System.ComponentModel
Imports System
Imports System.Web
Imports System.Web.UI

<DefaultProperty("Text"), ToolboxData("<{0}:ColorAccessor runat=server></{0}:ColorAccessor>")> Public Class ColorAccessor
    Inherits System.Web.UI.WebControls.WebControl

    Dim _text As String

    <Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As String
        Get
            Return _text
        End Get

        Set(ByVal Value As String)
            _text = Value
        End Set
    End Property

    Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
        output.Write([Text])
    End Sub

End Class

Namespace dbControls
    Public Class ColorAccessor : Inherits Control
        Private _text As String
        Private _color As String

        Public Property Text() As String
            Get
                Return _text
            End Get
            Set(ByVal Value As String)
                If Value <> "Good afternoon Ethan" Then
                    Throw New ArgumentException("You must enter Good Afternoon Ethan")
                Else
                    _text = Value
                End If
            End Set
        End Property

        Public Property Color() As String
            Get
                Return _color
            End Get
            Set(ByVal Value As String)
                _color = Value
            End Set
        End Property

        Protected Overrides Sub Render(ByVal output As HtmlTextWriter)
            output.AddAttribute("color", _color)
            output.RenderBeginTag("font")
            output.Write(_text)
            output.RenderEndTag()
        End Sub
    End Class
End Namespace

Thanks for the help.


Dolphin Bay, Inc. -- turning visions into eReality(tm) -- West Palm Beach, FL
Website Design, Internet Strategy, Search Engine Marketing

www.DolphinBay.biz
Reply With Quote
  #4 (permalink)  
Old April 2nd, 2004, 04:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I don't see what the problem is; the two classes declared above has the namespace declared for one and no namespace for the other... Is there an assembly switch for the vbc compiler where you can specify the assembly these controls are in? I'm not familiar with the vbc compiler.
Reply With Quote
  #5 (permalink)  
Old April 2nd, 2004, 07:56 PM
Authorized User
 
Join Date: Dec 2003
Location: , , .
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to DolphinBay
Default

I dont think so.. but then again I am fairly new to .Net. I am following examples in a book I have and the end result is the two additions to the toolbox.


Dolphin Bay, Inc. -- turning visions into eReality(tm) -- West Palm Beach, FL
Website Design, Internet Strategy, Search Engine Marketing

www.DolphinBay.biz
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to add controls to the visual studio toolbox luisjeronimo BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 June 28th, 2007 04:44 PM
C# adding custom controls in vs toolbox Khasim Visual Studio 2005 0 April 23rd, 2007 07:27 AM
LDAP adding entries to the server :: how to?? java_addict Pro JSP 0 April 8th, 2005 02:49 PM
Adding controls to C# clojinted General .NET 1 February 12th, 2005 03:17 PM
adding counts to search results gilgalbiblewheel Classic ASP Databases 0 August 6th, 2004 11:35 AM



All times are GMT -4. The time now is 10:45 AM.


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