Results 1 to 4 of 4

Thread: Creating run time controls on one form from another ?????????

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    How can I create control eg a button on a form by pressing a button on another form?

    I'm making a GUI editor for Powerbasic and the client form displays, and like in the VB IDE you click a botton and a button appears on that form, then I can click on the new button and drag it, resize it etc.

    if I use Dim X as New CommandButton, how do I make it appear on form2 ???

    Thanks

    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    Use Form2's controls collection and perform an Add command (Form2.Controls.Add) See MSDN for more details on the Controls collection and event trapping for these controls.
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    Thumbs up

    Thanks dood
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  4. #4
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Does a control array work also?

    No time to try it out for you, but can you create a hidden button on Form2 with index property set to 0, then when creating a new one,

    Code:
    x=1
    form2.load newButton(x)
    newButton(x).visible=true
    I think it will work fine - in fact I think I do this in a usercontrol I made.

    Regards
    Paul Lewis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width