Results 1 to 2 of 2

Thread: A good Piece of code found...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 1999
    Location
    Garden Grove, CA, USA
    Posts
    110

    Cool

    During my programming time from last year until now i was so frustrated with the Set Newform = new form1. Why? because after this line of code i can't access to form or any controls on the form. Until to day, i've found a piece of code that i thought it will help all of you have the same problem as i did, which is to have a copy of the form and can always have access to the form or its controls.

    Dim NewForm1(1 to 50) as New Form1

    'this will allow to you have up to 50 copy of Form1
    'like this.
    for every new copy you want to make just use an integer varible to create the number between 1 and 50 to the new form in the name of NewForm1(your-varialbe). if you have got a varible with the value 5 and the name of VarNum, then you NewForm will be like this.

    NewForm(VarNum).show 'shows/create the form

    To call the Form use:
    NewForm(5).controls/properties 'use to edit controls or

    'form's property.
    ngphuocthinh

  2. #2
    Addicted Member
    Join Date
    May 2000
    Location
    Westminster, Md.
    Posts
    163

    Newform=Form1

    Seems like that would be more memory intensive than neccessary. You may not know it but all of the forms reside in an 'object' called the Forms Collection. It's kinda like the Control collection, in which all of the controls are stored. You can iterate through them when needed and call them by number.

    You can do the same thing via the Forms object. You may wish to look it up in the help. This may solve your problem for you.


    Eiredrake

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