Advertisement
dbrazo

Friends

Feb 26th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 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 TwoFriendsInteractiveGUI
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void btnCompare_Click(object sender, EventArgs e)
  21.         {
  22.             string friend1, friend2;
  23.             btnCompare.Font = btnCompare.Font = new Font(btnCompare.Font.Name, 12, btnCompare.Font.Style, btnCompare.Font.Unit);
  24.             friend1 = Convert.ToString(txtFriend1.Text);
  25.             friend2 = Convert.ToString(txtFriend2.Text);
  26.             int compareStrings = String.Compare(friend1, friend2);
  27.             if (compareStrings == 0)
  28.             {
  29.                 btnCompare.Text = "The names are the same";
  30.             }
  31.             else
  32.             {
  33.                 btnCompare.Text = "The names are not the same";
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement