RadTextbox multiline split

3 posts, 0 answers
  1. Johnathan
    Johnathan avatar
    32 posts
    Member since:
    Sep 2012

    Posted 19 Jul 2012 Link to this post

    Hello,

    I'm attempting to work with a multi-line RadTextbox and split the text contained in it into a string array based on which "line" the text is on. So, it would look something like this:

    Text1
    Text2
    Text3
    ....

    So, Text1, Text2, and Text3 would be each their own array item. The user is required to hit enter after each line entry, so I'm attempted to split the textbox based on each enter key entry. I attempted the following splits, but none of these worked:

    RadTextbox.Text.Split("\r\n")
    RadTextbox.Text.Split(vbCrLf)
    RadTextbox.Text.Split(" ")
    RadTextbox.Text.Split(CChar(" "))

    Any help on this would be greatly appreciated.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 20 Jul 2012 Link to this post

    Hi Johnathan,

    Try the following code snippet to achieve your scenario.

    C#:
    protected void Button_Click(object sender, EventArgs e)
    {
     string[] split = RadTextBox1.Text.Split(new char[] { '\n' });
    }

    Hope this helps.

    Thanks,
    princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Johnathan
    Johnathan avatar
    32 posts
    Member since:
    Sep 2012

    Posted 21 Jul 2012 Link to this post

    Hey Princy,

    I was able to take the code you sent me and found an equivalent version in Visual Basic that worked. Thanks for you help!

    Note: Here's the code that worked

    Radtextbox1.Text.Split(ControlChars.Lf)

    Thanks,

    Johnathan
Back to Top