C# - Keys Enter

Keys Enter - Lagi iseng2 buka C#, kepikiran gimana caranya  Handler KeyPress control TextBox di C# :)... Kayanya master2 C# bakalan ngetawain postingan ane ni :)... Maklum ane kan masih nubie, and masih seneng nyoba2... Singkat cerita, ane nyoba2 nyampe pusing and ada sinyal2 buat nyerah juga, gimana ya caranya ko  ane ngerasa susah banget :(... Ga patah arang, ane nyoba2 and terus aja nyoba and sampe akhirnya ketemu juga :)... Ini ni code yg dah bikin ane pusing :)...

LANGKAH PERTAMA TULIS CODE INI...


private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == Convert.ToChar( Keys.Enter))MessageBox.Show("Enter", "Coba Enter", MessageBoxButtons.OK, MessageBoxIcon.Information);
}


SELANJUTNYA TARUH CODE INI...


textBox1.KeyPress += new KeyPressEventHandler(this.textBox1_KeyPress);


public Form1()


{
        InitializeComponent();


    >>> DISINI <<<
}

0 Response to "C# - Keys Enter"

Post a Comment