Results 1 to 4 of 4

Thread: [RESOLVED] Change Combobox Style

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2017
    Posts
    53

    Resolved [RESOLVED] Change Combobox Style

    Hi Guys
    How can i change the combobox without property ;
    I need change it by code in run time
    As combobox1.Style=2 ?

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,537

    Re: Change Combobox Style

    I don't think you can. At least not that easily. The reason is because it needs to be drawn at run-time, so the system needs to know how it's going to be rendered. You're trying to change the rules of the game and it's bottom of the 8th inning. That's not how it works.

    At least not that easily. Depending on what you're trying to do, you would be better off with multiple cbo's and swap them in/out as needed .... ooooooorrrr.... you take ownership of rendering the cbo yourself and make it ownerdrawn, and then take care of it in the paint event.

    So the question is - just what is it exactly you're trying to do here?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,936

    Re: Change Combobox Style

    I put together a UC that does it. It's sort of customized to my needs, but I'll post it.

    It's really just meant to toggle between DropdownList and DropdownCombo.

    The secret is all in the AllowTyping property.

    Also, after throwing together my little demo, I realize that I only intended to set it in Form_Load, and never change it. It'll take a bit more work if you wish to change it after the user is looking at it, as the Text property may be a bit confusing.

    In my case, I have certain fields that are a bit user-dependent. Some users like to be restricted to a pre-defined list, whereas others like to add items not on the list on-the-fly.

    Enjoy,
    Elroy
    Attached Files Attached Files
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  4. #4

    Thread Starter
    Member
    Join Date
    Nov 2017
    Posts
    53

    Re: [RESOLVED] Change Combobox Style

    Elroy
    thank you very much
    Exactly this is the solution required
    Amir Alzubidy
    VB4ARB.COM

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