locked
TextBox won't work as MultiLine ! RRS feed

  • Question

  • User-950116364 posted

    Hi;

    Im using a Multiline textbox, and I split the content line by line to store each line in string array

    My split Code :

    Dim A() As String = txt_Mobiles.Text.Split(Environment.NewLine)

    But this is not working, it read all lines as a single line !!!

    Note: I used this line of code before in another project and its work perfect.

    Help plz..

    Thank you

    Tuesday, August 9, 2011 6:07 AM

Answers

  • User-950116364 posted

    Solved !!

    The problem was from Google Chrome !

    I test it in IE .. works fine now

    Thank You all :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 9, 2011 6:58 AM

All replies

  • User-1188032534 posted

    Your code works fine for me, which browser are you using when testing?

    This is my test code:

        <div>
            <asp:TextBox ID="txtTest" TextMode="MultiLine" runat="server" />
            <asp:Button ID="btnTest" OnClick="btnTest_Click" runat="server" />
        </div>
        Protected Sub btnTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTest.Click
            Dim A() As String = txtTest.Text.Split(Environment.NewLine)
            System.Diagnostics.Debug.WriteLine(A.Length)
        End Sub

    Tuesday, August 9, 2011 6:33 AM
  • User-417784260 posted

    Try this instead

    Dim A() As String = txt_Mobiles.Text.Split(CChar(vbCrLf))
    
    Tuesday, August 9, 2011 6:35 AM
  • User-950116364 posted

    Hi Lazz_ ;

    Im using google chrome browser !

    but also in IE is not working :s 

    Tuesday, August 9, 2011 6:49 AM
  • User-950116364 posted

    Hi Ken Tucker ;

    I tried your code line but it is not working !!

    and i also tried the following:

    Dim sssssss As String() = TextBox2.Text.Trim.Split(ControlChars.NewLine)
    Dim ssssssss As String() = TextBox2.Text.Split(New Char() {Environment.NewLine})
    Dim sssssssss As String() = TextBox2.Text.Split(New Char() {ControlChars.NewLine})
    
    
    not working :s  !!
    Tuesday, August 9, 2011 6:50 AM
  • User-950116364 posted

    Solved !!

    The problem was from Google Chrome !

    I test it in IE .. works fine now

    Thank You all :)

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 9, 2011 6:58 AM