Comparing TextBoxes is quite easy in c#, below is a simple code that compare two textbox
I added 1 Button and 2 TextBoxes, when we press the button the program will tell us weather the the string in TextBox matches or not.
you will need to add two textbox and a button in your project for the above code to work
Download project .exe from here
: namespace Comparing
2: {
3: public partial class Form1 : Form
4: {
5: public Form1()
6: {
7: InitializeComponent();
8: }
9: private void button1_Click(object sender, EventArgs e)
10: {
11: if (textBox1.Text == textBox2.Text)
12: MessageBox.Show("String matched");
13: else
14: MessageBox.Show("String does not match","Result");
15: }
16: }
17: }
I added 1 Button and 2 TextBoxes, when we press the button the program will tell us weather the the string in TextBox matches or not.
you will need to add two textbox and a button in your project for the above code to work
Download project .exe from here
No comments:
Post a Comment