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. C#
  4. C# Questions relating to TextBox

C# Questions relating to TextBox

Scheduled Pinned Locked Moved C#
questioncsharphelp
5 Posts 5 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.
  • U Offline
    U Offline
    User 690568
    wrote on last edited by
    #1

    I'm a C# newbie. How can I insert a new line into a multi-line TextBox field? I've tried '\n' but instead of inserting a new line, it displays a strange character. Also, I want a particular method to execute when a user presses 'Enter' key after typing something in TextBox. Please help! :confused: mughalali

    H S 2 Replies Last reply
    0
    • U User 690568

      I'm a C# newbie. How can I insert a new line into a multi-line TextBox field? I've tried '\n' but instead of inserting a new line, it displays a strange character. Also, I want a particular method to execute when a user presses 'Enter' key after typing something in TextBox. Please help! :confused: mughalali

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      try "\r\n"

      1 Reply Last reply
      0
      • U User 690568

        I'm a C# newbie. How can I insert a new line into a multi-line TextBox field? I've tried '\n' but instead of inserting a new line, it displays a strange character. Also, I want a particular method to execute when a user presses 'Enter' key after typing something in TextBox. Please help! :confused: mughalali

        S Offline
        S Offline
        surgeproof
        wrote on last edited by
        #3

        if the other suggestion doesn't work, it may be something like   or one of those sets. for the return, why not do a keypress event? surgeproof ------------------------------------------------------- ithium is the best. 'Science without religion is lame, religion without science is blind.' --Albert Einstein 'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein

        K 1 Reply Last reply
        0
        • S surgeproof

          if the other suggestion doesn't work, it may be something like   or one of those sets. for the return, why not do a keypress event? surgeproof ------------------------------------------------------- ithium is the best. 'Science without religion is lame, religion without science is blind.' --Albert Einstein 'The pioneers of a warless world are the youth who refuse military service.' --Albert Einstein

          K Offline
          K Offline
          kayhustle
          wrote on last edited by
          #4

          Use Environment.NewLine, which will guarantee the placement of a newline.

          H 1 Reply Last reply
          0
          • K kayhustle

            Use Environment.NewLine, which will guarantee the placement of a newline.

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            Not necessarily in the TextBox (which encapsulates the Edit common control). To dislay new lines in a TextBox, the Multiline (inheritted from TextBoxBase) needs to be set to true, as well as the AcceptsReturn property.

            Microsoft MVP, Visual C# My Articles

            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