• 0

[C#] Display non-printable characters as spaces


Question

OK this is kind of an odd one.

What I'm looking to do is take a string of of text with linebreaks in it, and display it in a text box. For size reasons (long strings) I would like it to word wrap as nomal, based on the length of the control, and not based on the linebreak location. However for editing (and parsing) reasons, I would like the linebreaks to remain.

Now this is all fine and good, and easy to do... If you don't mind the not-printable character (little square) showing up, left, right and center.

What I would like to do is display the linebreak as as a good old fassion space. Now I know I could string.Replace(inputText, "\n", "");

But again once editing is done, I would like the linebreaks to still be in the string.

I don't know that there is any reasonabley easy way to do this (and have a feeling there isn't). But I thought I'd pick the brains of you bright folks any way.

TIA!!!

3 answers to this question

Recommended Posts

  • 0

It is, the TextBox is sized dynamically at runtime. The real issue is the the textBox's length can hold around 75 characters, and the linebreaks are at about 35 (give or take). Leaving a whole lot of room left in the TextBox control. Now since TextBoxes ignore linebreaks, and word wrap at the end of the control, it's works well (and is also the reason I can't use a RichTextEdit) but all the line breaks show up as the not-printable character.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • It has the same switch to allow whitelisting or not as the regular AdBlock extension.
    • These 20 crypto phishing applications are scamming Play Store users by Hamid Ganji Google Play Store is the main venue for Android users to download applications. While Google has strict rules and policies for verifying apps, some malicious apps somehow slip through anyway. Meanwhile, when it comes to crypto wallet apps, both Google app auditors and Play Store users need to be even more cautious. Cyble Research and Intelligence Labs has identified at least 20 crypto phishing applications on the Google Play Store that impersonate legitimate and popular crypto wallet apps and try to steal users' crypto credentials. By impersonation, these malicious apps trick users into downloading them and then start to capture the user's actual login data. "What makes this campaign particularly dangerous is the use of seemingly legitimate applications, hosted under previously benign or compromised developer accounts, combined with a large-scale phishing infrastructure linked to over 50 domains. This extends the campaign's reach and lowers the likelihood of immediate detection by traditional defenses." Cyble writes. Some of these malicious apps have the same name but come with a different package name. After removing duplicate names, here's the list of 9 newly discovered crypto phishing applications on the Play Store: Pancake Swap Suite Wallet Hyperliquid Raydium BullX Crypto OpenOcean Exchange Meteora Exchange SushiSwap Harvest Finance Blog According to Cyble, these apps prompt users to enter their 12-word mnemonic phrase to access the fake crypto wallet. Also, scammers use accounts that were previously used to distribute legitimate apps to minimize the risk of getting caught by Google. These accounts are more likely to be compromised and then taken over by scammers. If you've downloaded any of these fake crypto wallet apps from the Play Store, make sure to delete them as soon as possible. In 2024, revenue from crypto scams was estimated to be around $9.9 billion. This billion-dollar crypto scam business is expected to grow massively in 2025 thanks to AI.
    • Again...just because Microsoft never managed to be as successful as Google in that business that doesn't mean they are not exactly what Google is. An online advertising company. Edge's built in ad block in case you don't know whitelists their own advertising platform. According to Microsoft... Google ads and tracking bad, Microsoft ads and tracking good:)
  • Recent Achievements

    • Reacting Well
      viraltui earned a badge
      Reacting Well
    • Week One Done
      LunaFerret earned a badge
      Week One Done
    • Week One Done
      Ricky Chan earned a badge
      Week One Done
    • Week One Done
      maimutza earned a badge
      Week One Done
    • Week One Done
      abortretryfail earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      482
    2. 2
      +FloatingFatMan
      264
    3. 3
      snowy owl
      239
    4. 4
      ATLien_0
      228
    5. 5
      Edouard
      179
  • Tell a friend

    Love Neowin? Tell a friend!