Code -
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Exp5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string a = "Hello";
string b = "World";
textBox1.Text = string.Concat(a, b);
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
string a = "Java";
textBox2.Text = (String)a.Clone();
}
private void button3_Click(object sender, EventArgs e)
{
string str1 = "Java";
string str2 = "C# programming";
if (str1.Contains("C#") == true)
{
textBox3.Text = ("true");
}
else
{
textBox3.Text = ("false");
}
}
private void button4_Click(object sender, EventArgs e)
{
string a = "C++";
string b = "C";
if(a.Equals(b))
{
textBox4.Text = ("true");
}
else
{
textBox4.Text = ("false");
}
}
private void button5_Click(object sender, EventArgs e)
{
string s1 = "Hello";
string s2 = "llo";
if(s1.EndsWith(s2))
{
textBox5.Text = ("true");
}
else
{
textBox5.Text = ("false");
}
}
private void textBox5_TextChanged(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
string a1 = "Hello ";
string b1 = a1.Trim();
textBox6.Text = (b1);
}
private void textBox6_TextChanged(object sender, EventArgs e)
{
}
private void button7_Click(object sender, EventArgs e)
{
string a2 = "Hello";
string b3 = a2.Substring(2);
textBox7.Text = (b3);
}
private void button8_Click(object sender, EventArgs e)
{
string a3 = "Hello";
string b4 = a3.Replace("lo", "World");
textBox8.Text = (b4);
}
private void label2_Click(object sender, EventArgs e)
{
}
private void button10_Click(object sender, EventArgs e)
{
string k = "Hello C#";
string l = k.ToUpper();
textBox10.Text = (l);
}
private void button11_Click(object sender, EventArgs e)
{
string k = "Hello C#";
string l = k.ToLower();
textBox11.Text = (l);
}
private void button12_Click(object sender, EventArgs e)
{
string txt1 = "iron Man";
int l;
l = txt1.Length;
l = txt1.Replace(" ", "").Length;
textBox9.Text = l.ToString();
}
private void textBox9_TextChanged(object sender, EventArgs e)
{
}
private void button13_Click(object sender, EventArgs e)
{
string[] s1 = { "Hello", "C#", "Programming", "Language" };
string s3 = string.Join("-", s1);
textBox12.Text = (s3);
}
private void textBox12_TextChanged(object sender, EventArgs e)
{
}
private void button9_Click(object sender, EventArgs e)
{
string z1 = "Hello C#";
string z2 = z1.Remove(2);
textBox13.Text = (z2);
}
private void textBox13_TextChanged(object sender, EventArgs e)
{
}
private void button14_Click(object sender, EventArgs e)
{
string d1 = "Hello";
string d2 = "llo";
if (d1.StartsWith(d2))
{
textBox14.Text = ("true");
}
else
{
textBox14.Text = ("false");
}
}
private void textBox14_TextChanged(object sender, EventArgs e)
{
}
private void button15_Click(object sender, EventArgs e)
{
string f1 = "C++";
string f2 = "C";
if (f1.Equals(f2))
{
textBox15.Text = ("0");
}
else
{
textBox15.Text = ("1");
}
}
private void button16_Click(object sender, EventArgs e)
{
string g1 = "Hello ";
string g2 = string.Copy(g1);
textBox16.Text = (g2);
}
private void textBox16_TextChanged(object sender, EventArgs e)
{
}
private void button17_Click(object sender, EventArgs e)
{
string h1 = "Hello C#";
char[] ch = { 'H' };
string h2 = h1.TrimStart(ch);
textBox17.Text = (h2);
}
private void textBox17_TextChanged(object sender, EventArgs e)
{
}
private void button18_Click(object sender, EventArgs e)
{
string s1 = "Hello C#";
char[] ch = { '#' };
string s2 = s1.TrimEnd(ch);
textBox18.Text = (s2);
}
}
}
Output -
0 Comments