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. Moving a run-time generated ComboBox on a form

Moving a run-time generated ComboBox on a form

Scheduled Pinned Locked Moved Visual Basic
helpquestion
2 Posts 2 Posters 7 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
    Mixaela
    wrote on last edited by
    #1

    I'm trying to move a run-time generated ComboBox on a form, so I want to give the user the possibility to change the position of the ComboBox. For a TextBox control, I've solved the problem getting the control in drag state on MouseDown event.(Q103062 in MSDN). The code looks like this: MyTextBox.Drag 1 The problem is the a TextBox has the events MouseDown and MouseUp, while the ComboBox hasn't. Please someone help me with an idea?

    K 1 Reply Last reply
    0
    • M Mixaela

      I'm trying to move a run-time generated ComboBox on a form, so I want to give the user the possibility to change the position of the ComboBox. For a TextBox control, I've solved the problem getting the control in drag state on MouseDown event.(Q103062 in MSDN). The code looks like this: MyTextBox.Drag 1 The problem is the a TextBox has the events MouseDown and MouseUp, while the ComboBox hasn't. Please someone help me with an idea?

      K Offline
      K Offline
      Konstantin Vasserman
      wrote on last edited by
      #2

      I think you are going to have to build your own message handler for WM_LMOUSEDOWN and WM_LMOUSEUP on your ComboBox. You can refer to MSDN article Q170570 on how to do it. I was able move ComboBox on the form, but it is going to behave different depending on the Style property of your ComboBox. If your combo is a "Dropdown List" it will work just fine. If your combo is a "Dropdown Combo" you will be able to drag it only by the border or dropdown arrow. If you set your style to be a "Simple Combo" you will only be able to drag it by the border. In the case of "Simple Combo" and "DropDown Combo" when user clicks in the area of the combo box where he/she can type you do not recieve WM_LBUTTONDOWN message. That is probably why they did not expose MouseDown and MouseUp events in the first place. Well, this is all I can come up with right now. I hope this info will help you.

      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