dcsimg
Results 1 to 9 of 9

Thread: Duplicating a Form

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2009
    Location
    vbforums
    Posts
    809

    Duplicating a Form

    I want to create another Form similar to Form1 with controls .. I do not want to use select all , copy and past method for Form2 .. I tried to save Form1 as with different name and tried to add Form as existing , but I get error "Form" will not be loaded . Name is already in use

  2. #2
    Hyperactive Member
    Join Date
    Feb 2008
    Posts
    265

    Re: Duplicating a Form

    Does this help?
    Code:
    Private Sub Command1_Click()
        Dim NewForm As New Form1
        
        With NewForm
            .Visible = True
        End With
    End Sub

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2009
    Location
    vbforums
    Posts
    809

    Re: Duplicating a Form

    OK I solved my Problem of duplicating Form ..

    May I know

    How many Forms and Modules can be added in a vb6 project

    How many code lines should be in Form as well as Module

  4. #4
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,057

    Re: Duplicating a Form

    Quote Originally Posted by janu View Post
    How many Forms and Modules can be added in a vb6 project
    The Project Limitations states that:

    Quote Originally Posted by MSDN
    A single project can contain up to 32,000 "identifiers" (any nonreserved keyword), which include, but are not limited to, forms, controls, modules, variables, constants, procedures, functions, and objects. Note that the actual number of identifiers is limited to available memory.
    Quote Originally Posted by janu View Post
    How many code lines should be in Form as well as Module
    According to Code Limitations:

    Quote Originally Posted by MSDN
    The amount of code that can be loaded into a form, class, or standard module is limited to 65,534 lines. A single line of code can consist of up to 1023 bytes. Up to 256 blank spaces can precede the actual text on a single line, and no more than twenty-four line-continuation characters ( _) can be included in a single logical line.
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

  5. #5
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: Duplicating a Form

    Janu

    In addition to Bonnie's info, an individual Sub or Function can contain
    up to around 3,000 lines .. I don't know the exact number, but at least
    the IDE gives you a warning .. Too many lines in the Procedure.

    However, keep in mind .. there is no warning if you exceed the 65,534 line limit.
    If memory serves, when you go to run the app, you'll get the dreaded error message
    asking if you want to report the issue to Microsoft. The key point is that all code
    that you added since the last time you saved the app will be lost.

    Spoo

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    13,089

    Re: Duplicating a Form

    I remember back several years ago writing a VBA script that exceeded 64k in size. There was no message given but nothing at all happened when the script was run. It had worked correctly just a few minutes before but not at all. I commented out the newly added code and still nothing.

    It was a while before I caught the 64k thing and was able to correct the issue by removing a few lines of comments.

    I do not know for sure at what level this issue exists in VB6 perhaps a sub or function, perhaps a module or form or class but at some point there is an issue with over 64k bytes of code/comments

  7. #7
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Duplicating a Form

    Wasn't the 64K limit back when the chip was 8-Bit and could only handle an 8-bit address.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    13,089

    Re: Duplicating a Form

    When I ran into it in my VBA script that was under Windows NT on a Pentium Processor but I think that same thing would have happened on any system.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2009
    Location
    vbforums
    Posts
    809

    Re: Duplicating a Form

    I duplicated the forms with save as by different names .. when I use commend button to go to another it like blinks before appearing .. is there any way to run it smoothly with any blink or jerk

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width