473,795 Members | 3,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Howto create tabpages dynamically?

Hi NG,

I am looking for a good way to dynamically generate a bunch of TabPages.

I have a list of more or less identical object. For each of these objects I
need a user interface. My thought is, to provide a TabPage for every object
with controls on it to interact with them. How can that be achieved
dynamically.

The only way I can think of to do this is to prepare the max needed TabPages
and keep them in a list. But this would mean a lot of manual work. I am sure
there is a better way to do this. Is it possible to just define one TabPage
with the form designer and then inherit from it?

Thanks for hints and suggestions.

Rainer
May 17 '06 #1
4 3169
I have read several posts regarding the difficulties of populating a
TabControl with objects that inherit from TabPage. It can probably be
done, but all I've read about are problems.

There is another approach: you could create a factory method for each
TabPage layout. Pass the object you want to show on the UI, choose the
correct factory method based on the object, and the factory returns you
a TabPage all ready to go, as it were.

Then you just have to add the TabPage to the TabControl's page
collection and it should appear to the user.

May 17 '06 #2
Hi Bruce,

thanks for your reply.
There is another approach: you could create a factory method for each
TabPage layout. Pass the object you want to show on the UI, choose the
correct factory method based on the object, and the factory returns you
a TabPage all ready to go, as it were.

Then you just have to add the TabPage to the TabControl's page
collection and it should appear to the user.

This sounds like a good idea, but still means quite a bit of work. (I am a
lazzy person you must know ;-)
Following this sugestion, means I would have to create each control on the
TabPage at run time, do the right possitioning and then bind the controls to
the objects properties (how can I do this?) .

Is there a way to do a deep copy of a tabpage? This way I could design one
as a "master TabPage". Then the factory method could copy the controls for
the new TabPage from the master....

Regards
Rainer
May 17 '06 #3
Hi,

"Rainer Queck" <Ra****@noemail .noemail> wrote in message
news:OV******** ******@TK2MSFTN GP05.phx.gbl...
Hi Bruce,

thanks for your reply.
There is another approach: you could create a factory method for each
TabPage layout. Pass the object you want to show on the UI, choose the
correct factory method based on the object, and the factory returns you
a TabPage all ready to go, as it were.

Then you just have to add the TabPage to the TabControl's page
collection and it should appear to the user. This sounds like a good idea, but still means quite a bit of work. (I am a
lazzy person you must know ;-)


It's not that difficult, you said your objects were kind of similar , if so
you can have a predefined factory method that returns a tabpage with these
common fields (you can cut & paste it from the designer's generated code)
then the correct method factory fill up the rest of the controls, most
probably you have a small finite number of objets you want to handle this
way so you can define the code manually.
Is there a way to do a deep copy of a tabpage? This way I could design one
as a "master TabPage". Then the factory method could copy the controls for
the new TabPage from the master....


IMO this will be more complex to build and more slow to run
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
May 17 '06 #4
Hi Ignacio,
It's not that difficult, you said your objects were kind of similar , if
so you can have a predefined factory method that returns a tabpage with
these common fields (you can cut & paste it from the designer's generated
code) then the correct method factory fill up the rest of the controls,
most probably you have a small finite number of objets you want to handle
this way so you can define the code manually.

I was already putting this way in considerations. For the moment I found a
easier (not that beautiful but operatable) way.
- create TabPage
- create PropertyGrid
- add PropertyGrid (Fill) to TabPage
- add TabPage to TabControl.
As I said, not that beautiful, but it works for the moment. Through the
property grid I can now work on my objects ;-)

Regards
Rainer
May 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
10705
by: Michael Hertz | last post by:
Assume there is a XSD schema which describes the maximum possible number of fields which can occur in a XML document. How do I create such a form either as a HTML form or a text file from the XSD schema source? The DOM tree is automatically created by the parser. So there is only the need to create a form from this DOM tree. I feel that such a tool should be already available because it is a standard task. Does someone know such a...
2
1674
by: Giedrius | last post by:
I would like to create a typed dataset, from which I could create such xml document using WriteXML method. Is it possible? ............ <Fields Count=34> <Field Name="name1">value1</Field> <Field Name="name2">value2</Field> .... </Fields>
10
1972
by: Lars Grøtteland | last post by:
Hello! Was wondering how I can create a copy of one database? FYI I'm not interrested in the data, just the fields and triggers, and so on. Which way is the easiest? Do I create a script and run it from there? Is it smart to have it inside a SP? Any idea would be greatly appreciated.
2
2543
by: macca | last post by:
Hi, I am writing a GUI application. It will have a number of user defined controls( I plan to use/create a user defined control that will output alarm states that the user can also select and will open a dialog to give more detailed information) . The number of controls on the main GUI will vary from client site to client site. I would therefore like to populate the dialog with these controls dynamically.
3
1532
by: Lord2702 | last post by:
Sun. Aug. 22, 2004 2:20 PM PT How to create multifile assembly in Managed Visual C++ ? Using VSIDE. Please do not point me to MSDN pages, I already read those pages, and it only says, that you can create, (but no info, or steps how to create?) it in VSIDE, but no STEPS are given. I want this solution Only and Only in Managed VC++, with the use of VSIDE. Also as VSIDE 2003 is unable to create MakeFile, like VSIDE VC++ 6.0, MakeFile...
1
2740
by: Luc | last post by:
Hi, I have a TabControl and, at runtime, I need to add some tabpages. The problem is that each tabpage is similar to the others and contains several controls. If I do TabControl.TabPages.Add(MyTabPage), a new BLANK tabpage is added. How can I add in few statements a new tabpage as well as its controls (textboxes, labels, etc.)? The first tabpage (that I create at design time) is the "template" to be used for the other tabpages. Is...
1
1611
by: blabla120 | last post by:
Hello, I have a XML file <car> <brand>Mercedes</brand> </car> I want to transform it to this form:
0
1164
by: Suresh Sharma | last post by:
i want to know how to create page dynamically like Sulekha.com which show his record per html page through programm. I am working on project such like this and i want to implement like this? when i click 'next' button then it give (page1,page2,..........so on at last paging data showing. At this time page creation depend on data .
3
1362
by: priya1985 | last post by:
i need to create radiobuttons dynamically by reading from the database.... can anybody provide some help????
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10437
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.