3 Replies - 318 Views - Last Post: 22 January 2018 - 02:49 PM Rate Topic: -----

#1 Jeffro.69   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-January 18

How to make a Class to Fill Tab Pages?

Posted 22 January 2018 - 04:47 AM

Hi,

I am trying to clean up some code to make my . Net program look and run somewhat cleaner. In its present from there is a number of Tabs on a Tabpage Controls (which could be up to 20). They all contain similar but individual information. At present all these tabs are presently all designed individually prior to run time. Therefore a design change to a Tab results in every Tab being re-visited. Each tab may or may not take info from the form it is contained within.

What i would like to do is build a Class that populates the Tab when or if it is Opened or required. However i am struggling with the whole Class thing and how to implement this. Any suggestions as to whether this could be a viable solution and how I should go about this (as in where to start lol) or directions to a past post would be much appreciated.

Hope the question makes sense and thanks in advance. Due to the current size of the project i cant really post code. However i have been just trying to make a small prototype albeit unsuccessfully.

Cheers
Jeff

Is This A Good Question/Topic? 0
  • +

Replies To: How to make a Class to Fill Tab Pages?

#2 IronRazer   User is offline

  • Custom Control Freak
  • member icon

Reputation: 1492
  • View blog
  • Posts: 3,786
  • Joined: 01-February 13

Re: How to make a Class to Fill Tab Pages?

Posted 22 January 2018 - 10:12 AM

I am not sure if you mean you want to create a control type class, like a custom TabPage class or a UserControl class which contains all the controls already, and that you can easily just added to a TabPage or the TabControl, ...OR... if you mean you want to create a class that holds just the data/information that is used for the controls on the TabPages.

Without knowing that, and more about how much difference there is between the controls and/or data for the TabPages, it is hard to give any real answer.
Was This Post Helpful? 0
  • +
  • -

#3 Jeffro.69   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 22-January 18

Re: How to make a Class to Fill Tab Pages?

Posted 22 January 2018 - 12:25 PM

Thanks for the reply.

This is what I am trying to do "UserControl class which contains all the controls already, and that you can easily just added to a TabPage"
Was This Post Helpful? 0
  • +
  • -

#4 IronRazer   User is offline

  • Custom Control Freak
  • member icon

Reputation: 1492
  • View blog
  • Posts: 3,786
  • Joined: 01-February 13

Re: How to make a Class to Fill Tab Pages?

Posted 22 January 2018 - 02:49 PM

Ok, so you can create a UserControl in your application by going to the menu and clicking (Project) and selecting (Add User Control). Add the controls you need to it. You need to be aware though, that you will not have direct access to these controls from in your Form class. You will need to add your own Public Properties, Methods, and maybe some Events to the UserControl class in order to Get/Set specific properties of the controls on the UserControl or be notified of specific events.

After setting the UseControl up how you want it, you can then create a new instance of the UserControl and add it to a New TabPage, whenever it is that you add them.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1