Advertisement
aslen

Untitled

May 3rd, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace CheckBox
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void Conversion_Click(object sender, EventArgs e)
  21.         {
  22.             if ((!checkBox1.Checked) && (!checkBox2.Checked) && (!checkBox3.Checked))
  23.             {
  24.                 textBox2.Text = textBox1.Text;
  25.             }
  26.             else
  27.             {
  28.                 foreach (char ch in textBox1.Text)
  29.                 {
  30.                     string temp = ch.ToString();
  31.                     if (checkBox1.Checked)
  32.                     {
  33.                         if (char.IsDigit(ch))
  34.                             temp = "";
  35.                     }
  36.                     if (checkBox2.Checked)
  37.                     {
  38.                         if (char.IsLower(ch))
  39.                             temp = (char.ToUpper(ch).ToString());
  40.                         else if(char.IsUpper(ch))
  41.                             temp = (char.ToLower(ch).ToString());
  42.                     }
  43.                     if (checkBox3.Checked)
  44.                     {
  45.                         if (char.IsWhiteSpace(ch))
  46.                             temp = "";
  47.                     }
  48.                     textBox2.Text += temp;
  49.                 }
  50.             }
  51.            
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement