Chosen Software
Free Tech

Chosen Software:
Strings to Arrays

"Want to find out how to obtain the number of lines in a string from a Multi-Line TextBox?" or "How do I get the lines from a Multi-Line textbox into an array?"

Chosen Software: Free Tech

StringFunctions DLL

Some of the frequently asked questions that many starting software developers ask is: "How do I obtain the number of lines in a string from a Multi-Line TextBox?" or "How do I get the lines from a Multi-Line textbox into an array?" Hours of searching on Google have led you to no real solutions, and you have a deadline coming up for your completed application for work or uni.

At Chosen Software we have the solution in a convenient, easy-to-use DLL file that you reference into your application. And best of all, it's free with no limitations!

You can download the following files here:

the VB.NET solution.
the C#.NET solution..
the Chosen DLL file only..

Form1 Screenshot

VB.NET

Imports Chosen

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim Test As New Chosen.StringFunctions

      MsgBox(Test.GetNumberofLinesFromAString(TextBox1.Text))

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim Test As New Chosen.StringFunctions
Dim counter As Integer
Dim TestArray() As String

TestArray = Test.GetArrayofLinesFromAString(TextBox1.Text)

    For counter = 1 To TestArray.Length - 1

        MsgBox(TestArray(counter))

    Next counter

End Sub

End Class

C#.NET

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
     {

      public Form1()
        {
          InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

           Chosen.StringFunctions Test = new Chosen.StringFunctions();

           MessageBox.Show
(Convert.ToString(Test.GetNumberofLinesFromAString(textBox1.Text)));
        }

       private void button2_Click(object sender, EventArgs e)
        {
           Chosen.StringFunctions Test = new Chosen.StringFunctions();
           int counter = 1;
           string[] TestArray = null;

           TestArray = Test.GetArrayofLinesFromAString(textBox1.Text);

           for (counter = 1; counter <= TestArray.Length - 1; counter++)
           {
                 MessageBox.Show(TestArray[counter]);

           {

        }
     }
}