CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2001
    Posts
    8

    quantity of controls

    I was wondering if there is a way to modify the number of controls that can be used in a form. I reached the top of 252 and cannot enter one more. Can someone help me?

    thanks
    elporti


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: quantity of controls

    Each nongraphical control (all the controls except shape, line, image, and label) uses a window. Each
    window uses system resources, limiting the total number of windows that can exist at one time. The exact
    limit depends on the available system resources and the type of controls used.

    To reduce consumption of system resources, use the shape, line, label, and image controls instead of picture
    box controls to create or display graphics.

    Total Number of Controls
    The maximum number of controls allowed on a single form depends on the type of controls used and available
    system resources. However, there is a fixed limit of 254 control names per form.
    ---------------------------------
    A control array counts only
    once toward this limit because all the controls in the array share a single control name.
    ---------------------------------

    The limit on control array indexes is 0 to 32,767 on all versions.

    If you layer controls on top of each other, such as using several frame controls within other frames,
    Visual Basic will generally accept no more than 25 levels of nested controls.

    Limitations for Particular Controls
    The following table lists property limitations that apply to particular controls in Visual Basic.

    Property Applies to Limitation
    List and ListCount List box and combo box controls Maximum number of items is 32K; the limit on the size
    of each item is 1K (1024 bytes).

    Text Text box control Limited to 64K.

    Caption Label control Limited to 1024 bytes.

    Command button, check box, frame, and option button controls Limited to 255 characters. Any caption
    over these limits is truncated. Captions on custom control properties are limited to 32K.

    Menu control Limited to 235 characters.

    Tag All controls Limited only by available memory.

    Name All controls Limited to 40 characters.



    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    Oct 2001
    Posts
    8

    Re: quantity of controls

    Thank you Iouri. your answer was very illustrative. If I cannot avoid the problem I must search for another way to do the same. I was using the shape form to represent each tooth in a odontogram where you can see 52 teeth (32 for adult and 20 for child) each having 5 faces. Do you have another way to represent them. remember that each part can display information independently of the other 4 faces.

    thanks again
    enrique


  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: quantity of controls

    Did you try to use control array? It uses less memory. 1 array is like 1 control

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  5. #5
    Join Date
    Oct 2001
    Posts
    8

    Re: quantity of controls

    I never used control array. How do you use it?


  6. #6
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: quantity of controls

    Add a Textbox to the form. Call it Text1. Set index property = 0. Copy this text box and paste it to the form. On the prompt 'Do you want to create an array' answer yes. You will have 2 text boxes Text1(0) and Text1(1). This will be an arry with 2 elements 0 and 1. Continue this and you can create as many elemnts of the array as you want. The whole array will occupy memory like 1 textbox.

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured