We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Extra character (not visible) added to the retrieved text

Good morning, I''m currently testing the "edit component" for my company and I''ve got an issue with it. 1°) I set the edit control text to a specific string StartText = "toto" EditControl1.Text = StartText 2°) I retrieve the text from the edit control without modifying it at all. EndText = EditControl1.Text 3°) If I''m looking at the ascci codes of StartText and EndText, there are not the same! One ascii code is added to the end of EndText! StartText ASCII codes ("toto"): 116-111-116-111- EndText ASCII codes: 116-111-116-111-111- Could you please help me? You can find the source code (VB.NET) I used to test this issue. Just copy/paste it in a form and add an editcontrol and a button to it. Private StartText As String Private EndText As String Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load StartText = "toto" EditControl1.Text = StartText End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Long Dim TextToDisplay1 As String Dim TextToDisplay2 As String EndText = EditControl1.Text For i = 1 To Len(StartText) TextToDisplay1 = TextToDisplay1 & Asc(Mid(StartText, i, 1)) & "-" Next For i = 1 To Len(EndText) TextToDisplay2 = TextToDisplay1 & Asc(Mid(EndText, i, 1)) & "-" Next MsgBox(TextToDisplay1 & vbCrLf & TextToDisplay2) End Sub

3 Replies

AD Administrator Syncfusion Team March 13, 2006 11:07 AM UTC

Hi Jerome, Please modify the second ''for'' loop For i = 1 To Len(EndText) TextToDisplay2 = TextToDisplay1 & Asc(Mid(EndText, i, 1)) & "-" Next as given below For i = 1 To Len(EndText) TextToDisplay2 = TextToDisplay2 & Asc(Mid(EndText, i, 1)) & "-" Next TextToDisplay2 should be used instead of TextToDisplay1 in the ''for'' loop .The ascii codes of StartText and EndText, are the same.I have attached a sample that illustrates this.Let me know if you have any questions. Regards, Ebenezer.P

ASCII.zip


BA Baylaucq March 13, 2006 03:25 PM UTC

Shame on me!!! Sorry for this mistake. However, I''ve got another issue: I''m setting the StartText: StartText = "toto" & vbCrLf & "titi" Then, I''m giving this StartText to a textbox and an editcontrol. TextBox1.Text = StartText EditControl1.Text = StartText Those 2 controls are displaying correctly the StartText. But then, if I''m giving the editcontrol text to the textbox, the textbox is not displaying the text correctly: EndText = EditControl1.Text TextBox1.Text = EndText Indeed, vbCrLf (ascii codes 13 and 10) is replaced by the editcontrol by the unique ascii code 10. Is there a way to configure the editcontrol so that the newline code is not modified by the editcontrol? always ascci codes 13 and 10. I''ve tried to play with the DefaultNewLineStyle property without any success. Just copy/paste the code below (I promiss it is correct ;-) ) to a form with a textbox, an editcontrol and a button. --------------------------------------------- Private StartText As String Private EndText As String Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load StartText = "toto" & vbCrLf & "titi" TextBox1.Text = StartText EditControl1.Text = StartText End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Long Dim TextToDisplay1 As String Dim TextToDisplay2 As String EndText = EditControl1.Text TextBox1.Text = EndText For i = 1 To Len(StartText) TextToDisplay1 = TextToDisplay1 & Asc(Mid(StartText, i, 1)) & "-" Next For i = 1 To Len(EndText) TextToDisplay2 = TextToDisplay2 & Asc(Mid(EndText, i, 1)) & "-" Next MsgBox(TextToDisplay1 & vbCrLf & TextToDisplay2) ------------------------------------------ Regards, Jerome


AD Administrator Syncfusion Team March 14, 2006 07:33 AM UTC

Hi Jerome, Thanks for bringing this issue to our attention. I do see this problem here and have notified the development team in this regard. We have logged a bug report Defect# 1678 on this, and will try our very best to address the same at the earliest. You could track the progress of this bug fix at this link below : Defect #1678 - Ascii codes 13 and 10 replaced by EditControl. Thanks for your patience. Regards, Ebenezer.P

Loader.
Live Chat Icon For mobile
Up arrow icon