| | |
Toolbox vs manual creation
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2009
Posts: 31
Reputation:
Solved Threads: 3
With apologies to ddanbe, I just have a question regarding using the IDE toolbox vs programmatically creating form objects at run time. I use to fall into the habit of only using the tool box to create from objects such as buttons or picture boxes but have now started to create them in the form constructor. For example on my last project I needed to create 26 buttons, with each button representing the alphabet. I found that I could create them with less code and have all 26 buttons use one click() method. Normally I would have dragged and dropping each button from the tool box, modified its properties and created a cick() method for each button.
However this does make the form code look a bit messy since it is not in the form.designer.cs class.
I know it probably depends on circumstance but what method is better than other? Does it matter?
However this does make the form code look a bit messy since it is not in the form.designer.cs class.
I know it probably depends on circumstance but what method is better than other? Does it matter?
0
#2 24 Days Ago
No problem
Depends indeed.
If I have 2 or 3 buttons and some other controls, I let the IDE do his work. But in a case of 26 or more buttons it pays off to create them manually in a loop, so I guess you are right the way you like to do it.
The form.designer.cs class is just a part of the form class by the way!

Depends indeed.
If I have 2 or 3 buttons and some other controls, I let the IDE do his work. But in a case of 26 or more buttons it pays off to create them manually in a loop, so I guess you are right the way you like to do it.
The form.designer.cs class is just a part of the form class by the way!
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
0
#3 24 Days Ago
As danny suggested it depends. The only consideration I want to throw in here is cleanup. Be sure to clean up and
Dispose() of any controls you create that may have not been added to the control list of the form. Last edited by sknake; 24 Days Ago at 6:56 pm.
![]() |
Similar Threads
- Send data on a serial port (C++)
- Database Creation problem in Oracle (Oracle)
- cms in multi languages (PHP)
- MySQL syntax error check for the right syntax to use near 'A (A) )' at line 1 (PHP)
- Problem encounter by user when use the manual address book system (C)
- VxD creation for Windows 2000 server (C)
Other Threads in the C# Forum
- Previous Thread: Which will be faster?
- Next Thread: how to establish VPN between 2 PC through code?
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot marshalbyrefobject math mouseclick movingimage mysql mysql.data.client operator path photoshop php picturebox pixelinversion post programming radians regex remoting resourcefile richtextbox server sleep socket sql statistics stream string study system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






