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. Managed C++/CLI
  4. New line in textbox?

New line in textbox?

Scheduled Pinned Locked Moved Managed C++/CLI
data-structureshelpquestion
3 Posts 3 Posters 2 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.
  • E Offline
    E Offline
    EnkelIk
    wrote on last edited by
    #1

    Hi. I'm using a TextBox to display status messages to the user (like: "Retrieving MAC address: 002345235cbd" "Retrieving IP-number: 10.10.10.10" and so on). The messages are added line by line so that the first message is never over written. The only way I have found to be able to control when to get a new line is to use a String array and the set_Lines method, since neither \n, \v or \f has the desired effect. Is there no better way? The main problem using the TextBox->set_Lines method is that all the lines are set at the same time so I can't have different fontstyle on different lines. Anyone has a solution? Or should I use something else than TextBox to display the messages? If so what? Regards /EnkelIk

    C G 2 Replies Last reply
    0
    • E EnkelIk

      Hi. I'm using a TextBox to display status messages to the user (like: "Retrieving MAC address: 002345235cbd" "Retrieving IP-number: 10.10.10.10" and so on). The messages are added line by line so that the first message is never over written. The only way I have found to be able to control when to get a new line is to use a String array and the set_Lines method, since neither \n, \v or \f has the desired effect. Is there no better way? The main problem using the TextBox->set_Lines method is that all the lines are set at the same time so I can't have different fontstyle on different lines. Anyone has a solution? Or should I use something else than TextBox to display the messages? If so what? Regards /EnkelIk

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Environment.NewLine is the .NET friendly way to make something multiline, and make sure the text control is set to multiline also. Christian Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002 During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002

      1 Reply Last reply
      0
      • E EnkelIk

        Hi. I'm using a TextBox to display status messages to the user (like: "Retrieving MAC address: 002345235cbd" "Retrieving IP-number: 10.10.10.10" and so on). The messages are added line by line so that the first message is never over written. The only way I have found to be able to control when to get a new line is to use a String array and the set_Lines method, since neither \n, \v or \f has the desired effect. Is there no better way? The main problem using the TextBox->set_Lines method is that all the lines are set at the same time so I can't have different fontstyle on different lines. Anyone has a solution? Or should I use something else than TextBox to display the messages? If so what? Regards /EnkelIk

        G Offline
        G Offline
        group_captain_mandrake
        wrote on last edited by
        #3

        Yes, I can't find a better way than using strings and then doing something like: String* break="\r\n"; String::Concat(textString1,break,textString2); This is obviously a lousy solution because you have to put all of your strings together before you even display them! MS says that we shouldn't even be using strings anymore if they have to be manipulated repeatedly, but should use stringBuilder instead. Unfortunately, stringBuilder has been proven in clinical trials to cause insanity in 3 out of 5 users.

        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