Solved

Adding new instance of a custom control

Posted on 2014-03-10
2
262 Views
Last Modified: 2014-03-13
Greetings,

I have created a custom control based on a picturebox. If I drag it from the tool bar it works great. The code for it is below.

If however; on a code page I add private DRpictureBox e3picbox = new DRpictureBox ( );
I get an error of DRpictureBox is a 'namespace' but used as a 'type'

I have added the reference to the DRpicturebox and added a using for it as well.

What am I missing?

Thanks, Ron

namespace DRpictureBox
      {
      public partial class DRpictureBox : PictureBox
            {
            private string ipAddress = "192.168.1.0";
            private int modbusAddress = 90;

            [
                  Category("Addresses"),
                  Description("IP Address")
            ]
            
            
            public string IP
                  {
                  get { return ipAddress; }
                  set { ipAddress = value; Invalidate ( ); }
                  }

            [
                  Category("Addresses"),
                  Description("Modbus Address")
            ]

            public int Modbus
                  {
                  get { return modbusAddress; }
                  set { modbusAddress = value; Invalidate ( ); }
                  }

            public DRpictureBox ( )
                  {
                  }
            }
      }
0
Comment
Question by:rwensley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
SStory earned 500 total points
ID: 39917524
I think you'd need to do
DRpictureBox.DRpictureBox

Or change the namespace to not be the same name.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question