Saturday, 6 August 2011

(Dot net factory) Now check checkbox with a button and passing the controls accordingly


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)
Set Button = DotNetFactory.CreateInstance("System.Windows.Forms.Button", "System.Windows.Forms")
With Pos
.X = 90
.Y = 100
End With
With CheckBox
.Location = Pos
.Text = "My Check Box"
.Name = "chkCheckBox"
End With
With Pos
.X = 100
.Y = 130
End With
With Button
.Location = Pos
.Text = "Close"
End With
With Form
.Controls.Add CheckBox
.Controls.Add Button
.CancelButton = Button
.Text = "My Custom User Form"
.ShowDialog
End With
If CheckBox.Checked then
         msgbox "Check box Checked"
         else
        msgbox "Check box unchecked"
end if
Set CheckBox = Nothing
Set Button = Nothing
Set Pos = Nothing
Set Form = Nothing


If check box checked then

If checked box not checked 



No comments:

Post a Comment