Sunteți pe pagina 1din 2

using System;

using System.Windows.Forms;
using System.Drawing;
namespace try1
{
class trylang:Form
{
public TextBox tb1,tb2,tb3;
public Button b1;
Label l1, l2;
ComboBox cb;
trylang()
{
b1 = new Button();
l1 = new Label();
tb3 = new TextBox();
cb = new ComboBox();
l1.Location = new Point(100,100);
l1.Text = "Username";
tb2 = new TextBox();
tb2.Location = new Point(100,120);
l2 = new Label();
l2.Location = new Point(100,160);
l2.Text = "Password";
b1.Location = new Point(100,210);
b1.Text = "Login";
b1.Click += new System.EventHandler(b1_Click);
tb1 = new TextBox();
tb1.Location = new Point(100,180);
tb1.PasswordChar = '*';
string[] arr = new string[]{"Admin","SiSirUlet","</3"};
cb.DataSource = arr;
/*cb.Items.Add("Admin");
cb.Items.Add("Kalokohan");
cb.Items.Add("Huhuhuhirap");*/
//pwede rin ganito olyn ^ isa-isa mong i-aadd
cb.DropDownStyle = ComboBoxStyle.DropDownList;
cb.Location = new Point(10,10);
tb3.Location = new Point(10,50);
tb3.Enabled = false;
this.Controls.Add(b1);
this.Controls.Add(tb1);
this.Controls.Add(l1);
this.Controls.Add(tb2);
this.Controls.Add(l2);
this.Controls.Add(cb);
this.Controls.Add(tb3);
cb.SelectedIndexChanged += new System.EventHandler(combo
box);
}
public void combobox(object sender, EventArgs e)
{
tb3.Text = cb.SelectedItem.ToString();
}

public void b1_Click(object sender, EventArgs e)


{
tb1.CharacterCasing = CharacterCasing.Lower;
tb2.CharacterCasing = CharacterCasing.Lower;//tolower pa
rang ganern
if(tb1.Text == "ilovesirjay" && tb2.Text == "admin")//re
quest mo olyn hahahaha
{
MessageBox.Show("Successfully login!");
}
else
{
if(tb1.Text != "ilovesirjay" || tb1.Text == "")
{tb1.Clear();
MessageBox.Show("Incorrect password!");}
else if(tb2.Text != "admin"|| tb2.Text == "")
{
tb1.Clear();
tb2.Clear();
MessageBox.Show("Error!");
}
}
}
public static void Main()
{
Application.Run(new trylang());
}
}
}

S-ar putea să vă placă și