C# Source Codes: Split Text

Tuesday, December 22, 2009

Split Text







Source Code : Form1.cs

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 SplitText
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
string s;
string[] str;

s = richTextBox1.Text;
str = s.Split(',');

richTextBox2.Text = str[0];
richTextBox3.Text = str[1];
}
}
}




Source Code : Form1.Designer.cs

namespace SplitText
{
partial class Form1
{
///
/// Required designer variable.
///

private System.ComponentModel.IContainer components = null;

///
/// Clean up any resources being used.
///


protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
this.richTextBox3 = new System.Windows.Forms.RichTextBox();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(12, 33);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(262, 78);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// richTextBox2
//
this.richTextBox2.Location = new System.Drawing.Point(12, 176);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.Size = new System.Drawing.Size(108, 96);
this.richTextBox2.TabIndex = 1;
this.richTextBox2.Text = "";
//
// richTextBox3
//
this.richTextBox3.Location = new System.Drawing.Point(166, 176);
this.richTextBox3.Name = "richTextBox3";
this.richTextBox3.Size = new System.Drawing.Size(108, 96);
this.richTextBox3.TabIndex = 2;
this.richTextBox3.Text = "";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 11);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(152, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Enter your text with 1 comma !";
//
// button1
//
this.button1.Location = new System.Drawing.Point(78, 116);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(119, 26);
this.button1.TabIndex = 4;
this.button1.Text = "Split Text";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(9, 160);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(100, 13);
this.label2.TabIndex = 5;
this.label2.Text = "Text Before Comma";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(163, 160);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(102, 13);
this.label3.TabIndex = 6;
this.label3.Text = "Text Behind Comma";
//
// label4
//
this.label4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.label4.Location = new System.Drawing.Point(12, 145);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(253, 10);
this.label4.TabIndex = 7;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(286, 291);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label1);
this.Controls.Add(this.richTextBox3);
this.Controls.Add(this.richTextBox2);
this.Controls.Add(this.richTextBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = " Split Text";
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.RichTextBox richTextBox2;
private System.Windows.Forms.RichTextBox richTextBox3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
}
}





Download :

exe
http://sites.google.com/site/ogremyfiles/SplitText_EXE.rar
Source Code
http://sites.google.com/site/ogremyfiles/SplitText_SourceCode.rar



Designed by : Ogre