Solved

Adding new instance of a custom control

Posted on 2014-03-10
2
266 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Suggested Courses

752 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