Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 28th, 2006, 01:16 AM
Friend of Wrox
 
Join Date: Jan 2006
Location: Hardwar, Uttranchal, India.
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via ICQ to dpkbahuguna Send a message via MSN to dpkbahuguna Send a message via Yahoo to dpkbahuguna
Default Add Runtime Controls

Hi All !

         I've to add buttons at runtime. I've to do it using loop. I mean i want to add 4 buttons at FORM with different names e.g I dont want to use ARRAY of buttons.


      Thanks!

DPK..
__________________
DPK..
Reply With Quote
  #2 (permalink)  
Old November 28th, 2006, 11:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

use the controls.Add method
Reply With Quote
  #3 (permalink)  
Old December 7th, 2006, 08:55 AM
Noa Noa is offline
Registered User
 
Join Date: Dec 2006
Location: Hartlepool, County Durham, United Kingdom.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Noa
Default

if you are not sure how to use 'Controls.Add', here is a brief example.

Option Explicit

Private WithEvents MyButton As CommandButton

Private Sub Form_Load()

    Set MyButton = Controls.Add("VB.CommandButton", "Hello", Me)
    With MyButton
        .Visible = True
        .Caption = "Command1"
        .Top = 120
        .Left = 120
    End With
End Sub


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controls at runtime ITGeek ASP.NET 1.0 and 1.1 Basics 4 July 11th, 2007 05:23 AM
Add a reference on Runtime anandham Pro VB 6 3 September 18th, 2006 09:16 AM
Create Controls at Runtime everthalia Classic ASP Databases 2 July 30th, 2004 10:21 PM
How to create controls at runtime ? kishore_peddi C# 1 November 3rd, 2003 09:22 PM



All times are GMT -4. The time now is 01:13 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.