943,618 Members | Top Members by Rank

Ad:
May 30th, 2008
0

adding objects at runtime

Expand Post »
How can i add objects such as buttons, labels or textboxes at runtime?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
K-Dave is offline Offline
18 posts
since Jan 2008
May 30th, 2008
0

Re: adding objects at runtime

Hi
Example to adding control at runtime
VB Syntax (Toggle Plain Text)
  1. Option Explicit
  2. ' Declare object variable as CommandButton.
  3. Private WithEvents cmdObject As CommandButton
  4.  
  5. Private Sub Form_Load()
  6. Set cmdObject = Form1.Controls.Add("VB.CommandButton", "cmdOne")
  7. cmdObject.Visible = True
  8. cmdObject.Caption = "Dynamic CommandButton"
  9. End Sub
  10.  
  11. Private Sub cmdObject_Click()
  12. MsgBox "This is a dynamically added control"
  13. End Sub
Last edited by selvaganapathy; May 30th, 2008 at 9:33 am.
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008
May 30th, 2008
0

Re: adding objects at runtime

Yes u can, i think selvaganapathy was given the best answer
Reputation Points: 1182
Solved Threads: 392
Posting Sensei
Jx_Man is offline Offline
3,138 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: vb6 newbie needing some help
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Cyrillic into VB6





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC