NO Line Breaks in Label?

Malky

Active Member
Licensed User
Longtime User
Is there any reason why a label doesn't display text as it comes in? I retrieve data from a MySQL database, but when I display the text in the label there are no line breaks?
I could add them manually, but really shouldn't have to. Also the same database feeds my website, so I would have to change that as well if I started adding control characters.

Cheers,

Malk
 

Malky

Active Member
Licensed User
Longtime User
Hi Erel, thanks, but this doesn't help as I have one variable (text) from my database as a description with line breaks in it. I have searched arounf beforehand on the forum and found this, but nothing that does what I need.

If I pull in text that has

This is line 1
This is line 2

This is line 4


They all get joined together!

Malky
 
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
I used Sqlite database for my apps and it always works with break line in label. Did you check multiline property of label?
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Did you try RegEx function. Perhaps something like:
B4X:
Dim strDB As String  'String from MySQL database
Dim strSplit() As String = Regex.Split("YOUR PATTERN HERE", strDB)
For i=0 To strSplit.Length-1
   Label1.text=strSplit(i) & CRLF
Next
 
Upvote 0

Malky

Active Member
Licensed User
Longtime User
Sincere apologies guys, it appears that if I just paste the text into the db, it doesn't retain the control characters!

I did a manual sql insert with the text and it works well now.

Many thanks and especially to Erel who made me check the web response and redirected my thinking.

Malky
 
Upvote 0

Urishev

Member
Licensed User
Longtime User
Hi Erel! Why in version 5.50 is not working code:
Label1.Text = "FirstLine" & CRLF & "SecondLine"
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This is AN REALLY OLD Thread.

You should create a new thread for your question
 
Upvote 0
Top