Sunday, November 21, 2010

How do I create controls on the fly in VB 2005?

I need to make a panel with some checkboxes and buttons.

I have an identical one made with the forms designer that is visible on load, is there a way to clone that one?How do I create controls on the fly in VB 2005?
you've written 2 different questions:



1) How to create controls on the fly



For example:



Dim myCtrl as New Windows.Forms.CheckBox

myCtrl.Checked = True

myCtrl.Visible = True

myForm.Controls.Add (myCtrl)



Done! You've added a check box control to a form.



2) I don't get the second one. I think you should create a new instance of the graphically designed form...could you be a little more specific?



Good LuckHow do I create controls on the fly in VB 2005?
Hey, your answer helped my program out a lot. I was working with a Panel control, and without the myForm.Controls.Add(myCtrl) was missing. WIthout it, I would have been lost. Thanks

Report Abuse

  • used home bars for
  • No comments:

    Post a Comment