Monday, May 07, 2012 4:07 PMi have programmatically created a new project from a windows application. i now want to programmatically add a form to this project that already has some data bound controls on it. what way is there to do this?
thanks in advance
Monday, May 07, 2012 4:46 PM
how about inherit the new form from the existing one?
public class formDerived: inherits formExisting
- Edited by Endotherm Monday, May 07, 2012 4:48 PM
Monday, May 07, 2012 5:05 PM
thanks a lot for replying. can i do this from my application? basically the situation is like this. my application enables a user to select a database and presents the fields on a treeview. the user can then select one table from the field and drag and drop fields onto a different form. as soon as he drops the field the application creates data bound controls on the form.
here is where my qusetion comes in. my application then has to generate a new project (done that) and then programmatically add to the solution a form and then add to the form the control the user customized plus programmatic link to the database and create the databindings. can this be done?
Monday, May 07, 2012 6:08 PM
yes, it is possible to compile a exe on the fly, based on code files you dynamically generate. let me dig around for a sample.either way this is very ambitious, so it will take some doing to pull it off.
since you are building the form from code files, it should be a trivial matter to change the base class by adding an inherits clause to the class definition. there may be other ways however. I'd probably approach it by having a bunch of code blocks predefined as strings and moving them into the new document as its being built.
- Marked As Answer by Mark Liu-lxfModerator Wednesday, May 16, 2012 8:23 AM
Monday, May 07, 2012 6:31 PMmuch appreciated endotherm. samples would be great. thank you very much for your time.