CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2000
    Location
    America
    Posts
    130

    Blocking the ListBox Scrollbar

    I want to make my own scroll bar for a listbox, and disable the one they use when you get more items than can be displayed in the specified height. Is there a way i can replace the standard microsoft scrollbar with art of my own? Or can i just completely block it's scroll bar and code my own? Anyone got an idea how? Any help would be greatly appretiated. Thanx in advance - Atlantis


  2. #2
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Blocking the ListBox Scrollbar

    I answered a post earlier this year that showed how to remove the scrollbar from a listbox (I though it was a bit of a strange request - now I can see why it was required

    Take a look at :

    http://codeguru.developer.com/bbs/wt...age=&view=&sb=

    - it should help you get started with your own scrollbar, although you'll need to read up on the API messages that a ListBox deals with.


    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

  3. #3
    Join Date
    Feb 2000
    Location
    America
    Posts
    130

    Re: Blocking the ListBox Scrollbar

    Cool, Thanx. One more thing though. I'm sure this sounds very stupid, but...you're code uses "option explicit"...what's it do? heh... :/


  4. #4
    Join Date
    May 1999
    Location
    Oxford UK
    Posts
    1,459

    Re: Blocking the ListBox Scrollbar

    I really don't know why M$ decide to leave out 'Option Explicit' as a default when you create a VB project.

    Option Explicit at the top of every module (be it a form / control / module etc) tells VB that all variables must be declared somewhere in that module. If you miss out Option Explicit, then VB assumes that any non-declared variable is a variant (which use up lot's of memory - well, 16 bits each - plus the overhead of processing a variant). It can also lead to other problems with global / module wide variables.

    To turn on Option Explicit in Visual Basic, go to the Tools Menu->Editor Tab, and check the 'Requires Variable Declaration' box. It may seem a bit of a hassle, but in the long run, you'll save yourself a heap of work later on.


    Chris Eastwood

    CodeGuru - the website for developers
    http://codeguru.developer.com/vb

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