Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Adding new instance of a custom control

Posted on 2014-03-10
2
Medium Priority
?
271 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
1 Comment
 
LVL 25

Accepted Solution

by:
SStory earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Integration Management Part 2
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

783 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