Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Autosizing Combo Dropdown width (vs2005)

Autosizing Combo Dropdown width (vs2005)

Scheduled Pinned Locked Moved Visual Basic
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mark06
    wrote on last edited by
    #1

    Hey all, anyone know if there's a quick easy way to autosize the width of the dropdown box, based on the items it lists? Or is there a way of finding the width of a string in pixels, so I could set the dropdown width with that value? Any ideas for a Monday morning? Mark -- modified at 5:33 Monday 19th February, 2007

    K 1 Reply Last reply
    0
    • M Mark06

      Hey all, anyone know if there's a quick easy way to autosize the width of the dropdown box, based on the items it lists? Or is there a way of finding the width of a string in pixels, so I could set the dropdown width with that value? Any ideas for a Monday morning? Mark -- modified at 5:33 Monday 19th February, 2007

      K Offline
      K Offline
      Krish KP
      wrote on last edited by
      #2

      I just did a search in google and the first result link is http://www.vbrad.com/article.aspx?id=9[^]

      M 1 Reply Last reply
      0
      • K Krish KP

        I just did a search in google and the first result link is http://www.vbrad.com/article.aspx?id=9[^]

        M Offline
        M Offline
        Mark06
        wrote on last edited by
        #3

        That would be great if I was using VB6! I was hoping there was something abit simpler and more "managed" in .Net 2

        M 1 Reply Last reply
        0
        • M Mark06

          That would be great if I was using VB6! I was hoping there was something abit simpler and more "managed" in .Net 2

          M Offline
          M Offline
          Marcus J Smith
          wrote on last edited by
          #4

          I dont have the code right now but here is the suggestion for Googling. You cannot look at the length of the string itself you must look at the total character length of the values and keep the widest value and set that width value to the width of the combobox but add a little extra to include the width of the drop down arrow.


          Cleako

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups