Saturday, 6 August 2011

(Dot net factory) Now Create Checkbox in windows form


Using following class
Set Checkbox = DotNetFactory.CreateInstance("System.Windows.Forms.CheckBox", "System.Windows.Forms")

Form With checkbox

Set Form = DotNetFactory.CreateInstance("System.Windows.Forms.Form", "System.Windows.Forms")
Set Checkbox = DotNetFactory.CreateInstance("System.Windows.Forms.CheckBox", "System.Windows.Forms")
Set Pos = DotNetFactory.CreateInstance("System.Drawing.Point","System.Drawing",x,y)
With Pos
.X = 90
.Y = 100
End With
With CheckBox
.Location = Pos
.Text = "My Check Box"
.Name = "chkCheckBox"
End With
With Form
.Controls.Add CheckBox
.Text = "My Custom User Form"
.ShowDialog
End With
Set CheckBox = Nothing
Set Pos = Nothing
Set Form = Nothing

Output will be as follows


No comments:

Post a Comment