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. Windows Forms
  4. text box custom behaviour during edition

text box custom behaviour during edition

Scheduled Pinned Locked Moved Windows Forms
help
4 Posts 4 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.
  • W Offline
    W Offline
    Witoldek
    wrote on last edited by
    #1

    Hello everyone, Im wondering if its possible to make my control behave in the way described below: during editing text when user types enter normally cursor moves to the next line creating new emtpy line and then user can keep on writing. I would like to make it possible to move to another line by typeing enter only when the current line contains 10 characters. Hope taht my description of the problem is clear, thanks for any hint, Witek

    A J P 3 Replies Last reply
    0
    • W Witoldek

      Hello everyone, Im wondering if its possible to make my control behave in the way described below: during editing text when user types enter normally cursor moves to the next line creating new emtpy line and then user can keep on writing. I would like to make it possible to move to another line by typeing enter only when the current line contains 10 characters. Hope taht my description of the problem is clear, thanks for any hint, Witek

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      Should be possible. Check the length of the text and only allow the enter key though if the length of the text is a mutliple of 10. Put you code in the keydown(?) event of the text box. Hope this helps.

      Bob Ashfield Consultants Ltd

      1 Reply Last reply
      0
      • W Witoldek

        Hello everyone, Im wondering if its possible to make my control behave in the way described below: during editing text when user types enter normally cursor moves to the next line creating new emtpy line and then user can keep on writing. I would like to make it possible to move to another line by typeing enter only when the current line contains 10 characters. Hope taht my description of the problem is clear, thanks for any hint, Witek

        J Offline
        J Offline
        John Ad
        wrote on last edited by
        #3

        Hi Witek, Use events of Keys (KeyDown or KeyPress or may be you may use TextChanged event) and check for the conditions (if the control contains 10 characters or so). Then put the code for execution, may be forcing a line break or something as per the requirements. I hope this would be helpful.

        John Adams ComponentOne LLC. www.componentone.com

        1 Reply Last reply
        0
        • W Witoldek

          Hello everyone, Im wondering if its possible to make my control behave in the way described below: during editing text when user types enter normally cursor moves to the next line creating new emtpy line and then user can keep on writing. I would like to make it possible to move to another line by typeing enter only when the current line contains 10 characters. Hope taht my description of the problem is clear, thanks for any hint, Witek

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #4

          As the others have mentioned, wire together logic in the KeyDown event procedure. You'll have to make sure the textbox is set to handle multiple lines, as well.

          "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

          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