Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7743185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:28:03+00:00 2026-06-01T09:28:03+00:00

i created a class derived from CheckedListBox so i can change item height as

  • 0

i created a class derived from CheckedListBox so i can change item height
as this:

[ClassInterface(ClassInterfaceType.AutoDispatch)]    
[ComVisible(true)]
public class ExpandableChecked : CheckedListBox
{
    public ExpandableChecked()
        : base()
    {            
    }

    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
    [Browsable(false)]
    [EditorBrowsable(EditorBrowsableState.Never)]
    public override int ItemHeight
    {
        get;
        set;
    }        
}
  • everything is alright except for changing the control height in the designer
  • when i try to stretch its width or moving is great but stretch the height is giving this error message:

Attempted to divide by zero

whats wrong with it?

update: can i also add the itemHeight property to the properties window ??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:28:04+00:00Added an answer on June 1, 2026 at 9:28 am

    This goes wrong because of the IntegralHeight property, it defaults to True. With that set, the control ensures that the height is always a multiple of the item height so no partial items are visible. It does so by dividing the ClientSize.Height by the ItemHeight.

    Trouble is, you overrode the ItemHeight property and don’t initialize it at all. It will default to zero. So this division is going to bomb on a DivideByZeroException.

    It is very unclear on how you intend to use this overridden property and why you override it at all. Start by setting IntegralHeight to False in the constructor as one workaround.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a loading scene separate class derived from CCScene which I can
I have created a derived class from a base class and have added the
I created my class CData and derived it from CObject , because I need
I created a class derived from TThread that executes in background a query. I
I've created an MFC control class, which I derived from CWnd. The control is
I created an empty class derived from NSObject : typedef struct { NSInteger x;
I have created a custom class derived from Canvas, which contain elements which will
I'm trying to override a class derived from Activity (called NativeActivity) so I can
I created a class that's something like this: public class MovieTheaterList { public DateTime
I have an object that is derived from QThread and the class definition includes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.