Hello experts,
Created windows form to display text from textbox in label. Additional requirenent.
After entering the text and clicking the Parse button, the program should output the number of times each letter in the alphabet occurs in the textbox. Case sensitivity is not required.
For example, if the user enters baaad as the text and hits the Parse Button, the result control should display:
There are 3 A's
There are 1 B's
There are 0 C's
There are 1 D's
There are 0 E's
There are 0 F's
etc...
If this is worth more than 500 points will find some way of getting you a 1000 f or this one.
Thanks. Allen
+++existing code+++++
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace text_from_textbox
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Butto
n button1;
//private System.Windows.Forms.TextB
ox textBox1;
//public System.Windows.Forms.TextB
ox textBox1;
//private System.Windows.Forms.Label
label1;
//public System.Windows.Forms.Label
label1;
public System.Windows.Forms.TextB
ox textBox1;
public System.Windows.Forms.Label
label1;
private System.Windows.Forms.Label
label2;
private System.Windows.Forms.Label
label3;
private System.ComponentModel.Cont
ainer components = null;
public Form1()
{
// Required for Windows Form Designer support
InitializeComponent();
}
/// Clean up any resources being used.
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (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()
{
this.button1 = new System.Windows.Forms.Butto
n();
this.textBox1 = new System.Windows.Forms.TextB
ox();
this.label1 = new System.Windows.Forms.Label
();
this.label2 = new System.Windows.Forms.Label
();
this.label3 = new System.Windows.Forms.Label
();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(64, 112);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "Parse";
this.button1.Click += new System.EventHandler(this.b
utton1_Cli
ck);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(64, 80);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(64, 184);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(100, 48);
this.label1.TabIndex = 2;
//
// label2
//
this.label2.Location = new System.Drawing.Point(64, 56);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(176, 23);
this.label2.TabIndex = 3;
this.label2.Text = "Input text to be be parsed";
//
// label3
//
this.label3.Location = new System.Drawing.Point(64, 152);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(100, 16);
this.label3.TabIndex = 4;
this.label3.Text = "Parse output";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.lab
el3);
this.Controls.Add(this.lab
el2);
this.Controls.Add(this.lab
el1);
this.Controls.Add(this.tex
tBox1);
this.Controls.Add(this.but
ton1);
this.Name = "Form1";
this.Text = "Compare string to input";
this.Load += new System.EventHandler(this.F
orm1_Load)
;
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
//private void button1_Click(object sender, System.EventArgs e)
public void button1_Click(object sender, System.EventArgs e)
{
label1.Text = textBox1.Text;
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
}
}
Start Free Trial