Results 1 to 8 of 8

Thread: How to make the length of module name and class name exceed 39?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    How to make the length of module name and class name exceed 39?

    We know that the length of module name and class name in VB6 is not allowed to exceed 39, but this will cause a lot of trouble. Because of the readability of modern programs, the length of many module names and class names exceeds 39.

    I wonder if there is a way to make the length of module names and class names exceed 39? Thanks.

  2. #2
    Addicted Member
    Join Date
    Aug 2013
    Posts
    236

    Re: How to make the length of module name and class name exceed 39?

    Quote Originally Posted by SearchingDataOnly View Post
    We know that the length of module name and class name in VB6 is not allowed to exceed 39, but this will cause a lot of trouble. Because of the readability of modern programs, the length of many module names and class names exceeds 39.

    I wonder if there is a way to make the length of module names and class names exceed 39? Thanks.
    I didn't know that!
    39 seems like an odd number (no pun intended) for a limit.

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: How to make the length of module name and class name exceed 39?

    The docs say 40 characters. But since a line of code should not exceed 80 I can't imagine how longer names make any sense.

    "Modern" programs have readable code? Er, not really.

  4. #4
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,671

    Re: How to make the length of module name and class name exceed 39?

    https://docs.microsoft.com/ru-ru/win...m/-progid--key

    The format of a ProgID is <Program>.<Component>.<Version>, separated by periods and with no spaces, as in Word.Document.6. The ProgID must comply with the following requirements:

    • Have no more than 39 characters.
    • Contain no punctuation (including underscores) except one or more periods.
    • Not start with a digit.
    • Be different from the class name of any OLE 1 application, including the OLE 1 version of the same application, if there is one.


  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: How to make the length of module name and class name exceed 39?

    Project Limitations

    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.

    Variable names in Visual Basic can be no longer than 255 characters, and the names of forms, controls, modules, and classes cannot be longer than 40 characters. Visual Basic imposes no limit on the actual number of distinct objects in a project.
    So 39/40 seems to be in question. Doesn't hurt to assume 39 though.

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: How to make the length of module name and class name exceed 39?

    Code:
    Private Sub Form_Load()
        With New C234567890123456789012345678901234567890
            .X = 10
        End With
    End Sub
    Runs just fine. But a public class in a DLL might not I suppose.

  7. #7
    Fanatic Member Episcopal's Avatar
    Join Date
    Mar 2019
    Location
    Brazil
    Posts
    547

    Re: How to make the length of module name and class name exceed 39?

    already had this problem in my ocx control ...

    Edit: Really appears 39 for me too

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2020
    Posts
    1,421

    Re: How to make the length of module name and class name exceed 39?

    Quote Originally Posted by dilettante View Post
    Code:
    Private Sub Form_Load()
        With New C234567890123456789012345678901234567890
            .X = 10
        End With
    End Sub
    Runs just fine. But a public class in a DLL might not I suppose.
    When you click the VB6 menu item "Make Project1.exe", an error message will appear.

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