Solved

Adding new instance of a custom control

Posted on 2014-03-10
2
251 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now