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;
#region 吳新強於2013年4月10日10:55:03 桂電 2507
#endregion
namespace Compares
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
/// <summary>
/// 比較字符串是忽略大小寫
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
if(string.Compare(textBox1 .Text .ToLower (),textBox2.Text.ToLower())<0)
MessageBox.Show ("字符串1小於字符串2","信息",MessageBoxButtons.OK,MessageBoxIcon.Information );
if (string.Compare(textBox1.Text.ToLower(), textBox2.Text.ToLower()) == 0)
MessageBox.Show("字符串1等於字符串2", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
if (string.Compare(textBox1.Text.ToLower(), textBox2.Text.ToLower()) > 0)
MessageBox.Show("字符串1大於字符串2", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}