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. Using controls library to create a custom combobox

Using controls library to create a custom combobox

Scheduled Pinned Locked Moved Visual Basic
questionannouncement
7 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.
  • D Offline
    D Offline
    dptalt
    wrote on last edited by
    #1

    I created a Windows Controls Library project so that I could create my own modified version of a combobox. When I began the new project VB starts you out with a region to put your controls in. I drop a combobox in there and resized the region to be the same size as the combobox. When I tried using it in a new Windows project the right side of the combo is cut off. If I make that region a little bigger it shows up as being part of the combobox. Can you make this region invisible or keep it from interfering?

    D J 2 Replies Last reply
    0
    • D dptalt

      I created a Windows Controls Library project so that I could create my own modified version of a combobox. When I began the new project VB starts you out with a region to put your controls in. I drop a combobox in there and resized the region to be the same size as the combobox. When I tried using it in a new Windows project the right side of the combo is cut off. If I make that region a little bigger it shows up as being part of the combobox. Can you make this region invisible or keep it from interfering?

      D Offline
      D Offline
      Dave Sexton
      wrote on last edited by
      #2

      Try using the DockStyle property of the combobox control. You can either set it in the properties window of your custom control or do it in code (e.g. Combobox1.DockStyle = DockStyle.Top)

      D 1 Reply Last reply
      0
      • D Dave Sexton

        Try using the DockStyle property of the combobox control. You can either set it in the properties window of your custom control or do it in code (e.g. Combobox1.DockStyle = DockStyle.Top)

        D Offline
        D Offline
        dptalt
        wrote on last edited by
        #3

        Thanks. That worked. But also, while in the designer, if I click on the combobox I frequently cause VB to abnormally shut down. Why does this happen?

        D 1 Reply Last reply
        0
        • D dptalt

          I created a Windows Controls Library project so that I could create my own modified version of a combobox. When I began the new project VB starts you out with a region to put your controls in. I drop a combobox in there and resized the region to be the same size as the combobox. When I tried using it in a new Windows project the right side of the combo is cut off. If I make that region a little bigger it shows up as being part of the combobox. Can you make this region invisible or keep it from interfering?

          J Offline
          J Offline
          James Foxall
          wrote on last edited by
          #4

          Something else to consider: if you're only using a single combo box for your control, you should look into inheriting the Windows.Forms.ComboBox. This will solve your display issues. You can get started very easily by pasting this class declaration into a new Class file, overwriting the default text: Public Class MyCustomCombo Inherits System.Windows.Forms.ComboBox End Class Mind you, programming an inherited control can be tricky, but the rewards are worth it.

          james commercial developer, author, speaker, dude. www.jamesfoxall.com

          D 1 Reply Last reply
          0
          • J James Foxall

            Something else to consider: if you're only using a single combo box for your control, you should look into inheriting the Windows.Forms.ComboBox. This will solve your display issues. You can get started very easily by pasting this class declaration into a new Class file, overwriting the default text: Public Class MyCustomCombo Inherits System.Windows.Forms.ComboBox End Class Mind you, programming an inherited control can be tricky, but the rewards are worth it.

            james commercial developer, author, speaker, dude. www.jamesfoxall.com

            D Offline
            D Offline
            Dave Sexton
            wrote on last edited by
            #5

            You read my mind :) but I was thinking it might be a bit too tricky for him considering he's still getting to grips with custom control authoring.

            J 1 Reply Last reply
            0
            • D dptalt

              Thanks. That worked. But also, while in the designer, if I click on the combobox I frequently cause VB to abnormally shut down. Why does this happen?

              D Offline
              D Offline
              Dave Sexton
              wrote on last edited by
              #6

              I'm not sure, it could be a bug in your copy of VS or perhaps your machine is screwing up somehow, or it may even be (tho I doubt it) your code. Quite honestly, I have no idea.

              1 Reply Last reply
              0
              • D Dave Sexton

                You read my mind :) but I was thinking it might be a bit too tricky for him considering he's still getting to grips with custom control authoring.

                J Offline
                J Offline
                James Foxall
                wrote on last edited by
                #7

                I agree, but I wanted to throw it out there. It's certainly worth spending a half hour with google over. :)

                james commercial developer, author, speaker, dude. www.jamesfoxall.com

                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