Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Noob Question 2

Status
Not open for further replies.
Jun 17, 2004
73
US
Ok still kind of new to C# and .net in general so this is a really beginner question. I understand Inheritance, just not sure how I would use it for my problem.

I created an image viewer(form1). I want to be able to put that viewer on other forms, say a personal information(form2) or a CS screen(form3).

Do I just combine to say form1 and form3 to a new form or make form2 larger so form1 can fit on form2?

Also not sure how I would bring the 2 together. Just not sure how you inherit picture boxes, textboxes and everything else. I fully understand inheriting variables and functions. It might be all the same, a link on where I could learn this would be much appriciated.

/cry
/help

[viking2]
LVL 60 ROGUE
 
I believe that you should have created a user control and so drag it from the toolbox to other forms (lust like you would do if you added a picturebox or a button..).

The use of inheritance is to upgrate and existing control.. i mean to add (or override) new functionallity.

Post if you need or have other questions.
 
Ok, I have not gotten to far I will see about making it into a control, never did that but I am sure it bill easy to find how to do it.

Thanks

/cry
/help

[viking2]
LVL 60 ROGUE
 
To make that simple, you can probably change the line in your form from

public class ImageViewer : System.Windows.Forms.Form

to

public class ImageViewer : System.Windows.Forms.UserControl

And it should take care of itself.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top