Results 1 to 9 of 9

Thread: How to edit the combobox's text like a normal textbox?

  1. #1

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464

    How to edit the combobox's text like a normal textbox?

    I have a combobox that I use as a url address bar in my app. The problem I am having is I can't use my mouse to highlight certain parts of the text. When I click on the text, it is all highlighted, but then when I try to click at the end of the text and drag my mouse over it as to highlight certain parts of it, it doesn't work.

    For example, if I have this text in the combobox:
    http://www.vbforums.com/something.htm
    and I want to highlight the /something.htm part of it so I can delete it, I can't. I would have to position the cursor at the end, and push the backspace key.

    Is there a way to fix this?

  2. #2

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    No one huh? Am I going to have to make a custom control just to do this? Seems unreasonable, but will do it if I have to.

  3. #3
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Seems to me you could mess with the ComboBox.SelectionStart and SelectionLength properties on the MouseDown event, or just get comfortable with the MS editing keys (control-shift-left, control-shift-right to select a word at a time).

  4. #4

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Seems like an awful lot of code to do this for something a textbox does automatically.

    I think I would rather create my own control that is based on the textbox, but add some combo box functionality....not sure yet.

    Anyone else have any ideas? A property that I am forgetting maybe?

  5. #5
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    Dunno if it's going to end up any simpler to add pulldown guts to TextBox than it will be to add mouse selection guts to ComboBox... Good luck though.

  6. #6

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Originally posted by Slow_Learner
    Dunno if it's going to end up any simpler to add pulldown guts to TextBox than it will be to add mouse selection guts to ComboBox... Good luck though.
    I am not so sure. I can easily make a user control that has a combobox under a textbox, and only the down arrow showing. Then when ever the text is changed in one, it is reflected in the other... Seems easy, but who knows. Of course, then I have to deal with the resizing, and maybe do a little GDI+ work to make it look pretty.

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    This may or may not help you but I wanted a specific look to a combo for a project, basically a label with a dropdown list. So I made a wrapper class to add the label over the combo. You'd have to add a button too but it should give you a way to easily replace teh text part of the combo with a normal textbox without making a whole new control. All hail inheritance.
    Last edited by Edneeis; Oct 20th, 2002 at 08:01 PM.

  8. #8
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Actually it turns out there is no Sunday night football game so I worked up one that uses a textbox and button. It might need some fine tuning to your liking but it should get you a good start.

  9. #9

    Thread Starter
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Thanks a lot, that was exactly what I was thinking of doing, just didn't do it yet....

    Thanks again.

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