• 0

How to recognize Chr(13) in textbox ?


Question

  • 0
  Elagizy said:
hi

when i run this code "enter" is recognized ...

If InStr(Text1.Text, Chr(13), CompareMethod.Binary) Then

but this code,  "enter" is not recognized ... WHY ?

If Text1.Text = Chr(13) Then

i need to know how to recognize if Text1.text = chr(13) only or not ?

thanks for any help

585659076[/snapback]

Check the length of the string?

11 answers to this question

Recommended Posts

  • 0
  gameguy said:
For Windows machines, you need to use both characters 13 (carriage return) and 10 (new line).

In fact, it's better off not to use the individual characters at all. Instead, use Environment.NewLine (Y)

585659270[/snapback]

can you tell me the code, pleaaaaaase ?

  • 0
  Elagizy said:
i did it anyway :p, besides i can't understand what do you mean .

585659575[/snapback]

He's talking about using the .NET method System.Environment.NewLine.

It returns the new line based on the current environment, there's no difference right now, but future wise when the framework is ported to another OS, the new line will differe across platforms, it's just better to conform this way earlier, so that your applications would have the possibility of being compatible with other OS's providing that a framework is created for another OS withing the future.

  • 0
  Winston said:
He's talking about using the .NET method System.Environment.NewLine.

It returns the new line based on the current environment, there's no difference right now, but future wise when the framework is ported to another OS, the new line will differe across platforms, it's just better to conform this way earlier, so that your applications would have the possibility of being compatible with other OS's providing that a framework is created for another OS withing the future.

585659936[/snapback]

hmm, ok can you please give me the code which recognize if text1.text = chr(13) using System.Environment.NewLine cause i can't do it

  • 0
  Elagizy said:
hmm, ok can you please give me the code which recognize if text1.text = chr(13) using System.Environment.NewLine cause i can't do it

585659997[/snapback]

Actually an easier way would be using this

    Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
        If e.KeyCode.Enter Then
            MessageBox.Show("Ita carriage return")
        End If
    End Sub

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

    • No registered users viewing this page.
  • Posts

    • That adverting your referring to can basically be turned off with a few Windows settings. The only advertising I've seen in the last couple of years on Windows 11 is Outlook ads because I don't have a Microsoft 365 subscription. That said, it took me only a couple days to get used to ignoring those ads. I would prefer they weren't there but it's not a big deal.
    • Petty nerd sums up many peoples dislike for things. i.e. Windows 11
    • I've been using Windows 11 since the day it was released. No complaints whatsoever from me but then again, I always like trying new things. It's been ROCK SOLID running my Dell XPS 8940 desktop.
    • So many things to unpack here I don't even know where to begin...
    • Cjam 1.9.9.0 by Razvan Serea Cjam is a lightweight and fast MP3 editor for Windows that lets you cut, join, and edit MP3 files without re-encoding. This means your audio quality remains untouched, and edits happen instantly. Cjam is ideal for quick, lossless edits—whether you're trimming music, combining tracks, or preparing audio for learning tools or podcasts. It features batch processing, scripting support, cue and playlist file handling, and a simple interface. Cjam is perfect for anyone who needs efficient MP3 editing without the complexity of full audio suites. Cjam requires a PC running Windows 10 or later and Microsoft .NET 6.0 or later. Key features for Cjam: No Re-encoding: Edit MP3 files without losing quality. Cut and Join MP3: Easily cut, trim, and combine MP3 tracks. Batch Processing: Edit multiple files at once for faster workflows. Scriptable Interface: Automate tasks with a custom command language. Cue and Playlist Support: Handle CUE and playlist files for seamless audio management. Fast and Lightweight: Quick processing with minimal system resources. Lossless Audio Editing: Ensure your edits don't affect audio quality. Simple User Interface: Clean, intuitive design for easy navigation. File Format Support: Works with MP3, Cjam-specific file formats (CJAMC, CJAMJ, CJAM). Cjam 1.9.9.0 fixes: Fixed a bug related to playback display on the main screen Download: Cjam 1.9.9.0 | 1.3 MB (Freeware) Links: Cjam Home Page | Cjam Manual | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Explorer
      Legend20 went up a rank
      Explorer
    • One Month Later
      jezzzy earned a badge
      One Month Later
    • First Post
      CSpera earned a badge
      First Post
    • One Month Later
      MIR JOHNNY BLAZE earned a badge
      One Month Later
    • Apprentice
      Wireless wookie went up a rank
      Apprentice
  • Popular Contributors

    1. 1
      +primortal
      635
    2. 2
      ATLien_0
      281
    3. 3
      +FloatingFatMan
      182
    4. 4
      Michael Scrip
      151
    5. 5
      Steven P.
      117
  • Tell a friend

    Love Neowin? Tell a friend!