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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Ignoring Text Entered into a ComboBox

Ignoring Text Entered into a ComboBox

Scheduled Pinned Locked Moved Visual Basic
databasecsharphelptutorialquestion
2 Posts 2 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.
  • T Offline
    T Offline
    td2985
    wrote on last edited by
    #1

    First point of interest is that the application is being developed on a mobile device using .NET CF 2.0. On to the problem... I have a combo box set to DropDown so the user can enter text if the provided options don't apply. This text eventually is sent, via a stored procedure, to a database. I'm trying to limit the number of characters allowed in this combo box to the max size of the field in the particular table I'll be writing to. The problem is that .NET CF 2.0 ComboBox doesn't include any method for setting the position of the cursor within the combo box. As of right now, once the limit is reached I set the text of the combo box back to what it was prior to the key being pressed. This, unfortunately, causes the cursor to return to the front of the combo box. I want the cursor to remain at the end of the text. Anyone encounter (and overcome) this problem in the past? Or perhaps any ideas of how to overcome it?

    B 1 Reply Last reply
    0
    • T td2985

      First point of interest is that the application is being developed on a mobile device using .NET CF 2.0. On to the problem... I have a combo box set to DropDown so the user can enter text if the provided options don't apply. This text eventually is sent, via a stored procedure, to a database. I'm trying to limit the number of characters allowed in this combo box to the max size of the field in the particular table I'll be writing to. The problem is that .NET CF 2.0 ComboBox doesn't include any method for setting the position of the cursor within the combo box. As of right now, once the limit is reached I set the text of the combo box back to what it was prior to the key being pressed. This, unfortunately, causes the cursor to return to the front of the combo box. I want the cursor to remain at the end of the text. Anyone encounter (and overcome) this problem in the past? Or perhaps any ideas of how to overcome it?

      B Offline
      B Offline
      BDEz Member 3919223
      wrote on last edited by
      #2

      Just a thought, but maybe you can set up a text changed event and count how long your text string is. Once the text hits a length = X then run a REGEX to replace the next char with a back space.

      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