|
-
Dec 27th, 2005, 10:11 PM
#1
Thread Starter
Addicted Member
What is this?
What I'm trying to do is clone a panel with some controls on it??
I recieve this error message:
'Panel1' is a 'field' but is used like a 'type'
Here is my code:
VB Code:
Panel1 pnl = (Panel)new Panel1();
pnl.Left = 25;
pnl.Top = 200;
this.Controls.Add(pnl);
What is going on here?
Visual Studio.Net 2003
"Every man has been made by God in order to acquire knowledge and contemplate."
--Pythagoras
-
Dec 27th, 2005, 10:19 PM
#2
Re: What is this?
A field is a member variable, so the error is saying that you are using a member variable as though it was a type. If you've added a Panel to your form in the designer and named it "Panel1" then you have created a member variable named Panel1, not a class named Panel1 that you can create instances of, which your first line is trying to do. Perhaps you need to create a UserControl if you want to use a set of controls in more than one place.
-
Dec 27th, 2005, 10:31 PM
#3
Thread Starter
Addicted Member
Re: What is this?
Thanks for the reply!
Looks like I'll have to crate a user control.
Visual Studio.Net 2003
"Every man has been made by God in order to acquire knowledge and contemplate."
--Pythagoras
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|