GangOne Style
GangOne Style

Reputation: 81

How to remove new line in vb.net

i have a problem to remove new line in vb .net.. ex:

A

B
C

i've try this code

replace (string,chr(13),"*")

and the result is

A*
*
B *
C

i want to remove the new line after i replaced the chr(13) like this:

A**B*C

i use this code for help me in text encryption with vigenere cipher Help me please....

Upvotes: 1

Views: 20928

Answers (3)

Mark Hall
Mark Hall

Reputation: 54532

Remove the Line Feed also, Chr(10), see this link for explanation. In short a windows line ending consists of a Carriage Return and a Line Feed. and is represented in VB with the VbCrLf constant.

Upvotes: 4

Israel Ocbina
Israel Ocbina

Reputation: 577

Example you have entered a string text like the one below:

Hi
I
Am
a .Net Developer...

You may do like this.

var c = txtWords.Text.Replace(@"\n","");

or

var c = txtWords.Text.Replace("\\n","");

Upvotes: 0

Arun Bertil
Arun Bertil

Reputation: 4638

The following string contains carriage returns. In VB they are declared as "vbCrLf", so you can remove them with

a = Replace(a, vbCrLf, "")

Upvotes: 4

Related Questions