Example of usage

Example 1

Generate a form with just a int value:

var form = WinFormGenerator.Generator.GenerateWinForm(typeof(int));

This will give you a form with a numericUpDown control and an ok/cancel button.

Example 2

To generate the example in Home with a class user we do it the same way:

var user = new User { Name = "Mille", Id = 22 }; 
var form = WinFormGenerator.Generator.GenerateWinForm(typeof(User), user) 

Example 3

Full usage example:

var form = Generator.GenerateWinForm(typeof(User),new User {Id = 22});
User user;
if (form.ShowDialog() == DialogResult.OK)
     user = (User) form.Object; 

//Do stuff with user 


  • Form (Text, Height) - Class Attribute, change title and/or height of form.
  • FormIgnore - Property Attribute - Ignore this property when generating form
  • FormText (Multiline, Rows) - Property Attribute - Change textbox to multiline and set number of rows.
  • FormNumber (Max, Min) - Property Attribute - Change min and max on numericUpAndDown

Last edited Jul 12, 2014 at 8:45 AM by Meeii, version 8