M Malky Active Member Licensed User Longtime User Feb 17, 2013 #1 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
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
Erel B4X founder Staff member Licensed User Longtime User Feb 17, 2013 #2 Labels can show multiple lines. Try this code: Code: Label1.Text = "FirstLine" & CRLF & "SecondLine" Upvote 0
M Malky Active Member Licensed User Longtime User Feb 17, 2013 #3 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
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
S susu Well-Known Member Licensed User Longtime User Feb 17, 2013 #4 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
I used Sqlite database for my apps and it always works with break line in label. Did you check multiline property of label?
M Malky Active Member Licensed User Longtime User Feb 17, 2013 #5 I don't get an option of multiline option when I add a "." after the variable? Malky Upvote 0
M Mahares Expert Licensed User Longtime User Feb 17, 2013 #6 Did you try RegEx function. Perhaps something like: Code: 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
Did you try RegEx function. Perhaps something like: Code: 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
Erel B4X founder Staff member Licensed User Longtime User Feb 17, 2013 #7 The problem is most probably in the server response. Try to save the string to a text file (File.WriteString) and then upload the text file to the forum. Upvote 0
The problem is most probably in the server response. Try to save the string to a text file (File.WriteString) and then upload the text file to the forum.
Erel B4X founder Staff member Licensed User Longtime User Feb 17, 2013 #8 I've deleted your post from the other thread as the other thread is two years old and it is clear that the problem is in the string and not in File.WriteString or Label.Text. Please upload the text file. Maybe it uses a different end of line character. Upvote 0
I've deleted your post from the other thread as the other thread is two years old and it is clear that the problem is in the string and not in File.WriteString or Label.Text. Please upload the text file. Maybe it uses a different end of line character.
M Malky Active Member Licensed User Longtime User Feb 17, 2013 #9 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
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
Urishev Member Licensed User Longtime User Mar 24, 2016 #10 Hi Erel! Why in version 5.50 is not working code: Label1.Text = "FirstLine" & CRLF & "SecondLine" Upvote 0
DonManfred Expert Licensed User Longtime User Mar 24, 2016 #11 This is AN REALLY OLD Thread. You should create a new thread for your question Upvote 0