C Sharp Net


1 - “void” bildirisiyle tanimlanir.
2 - Diger form ve classlarin kullanilmasi istenirse “public”, sadece aktif formun kullanilmasi istenirse “private” ile tanimlanir. Eger herhangi bir tanim yapilmazsa private olarak algilanir.

Ornek:

private void GMesaj()
{
this.Text = “Gizli Mesaj…”;
}

private void Form13_Load(object sender, EventArgs e)
{
GMesaj();
}

Asagidaki kodu textboxun kontrolunun keypress yordamina yazdiginiz takdirde, textbox kontrolunuze rakam haricinde hic bir deger girilemeyecektir.

{
if ((e.KeyChar >= (Char)58) || (e.KeyChar <= (Char)47))
{
e.Handled = true;
}
}

Formumuza ekledigimiz kontrollerin yordamlarina, properties penceresinde ust kisminda yer alan simsek isaretine tiklayarak ulasabiliriz. Eklemek istedigimiz yordamin uzerine cift tiklayarak ekleme islemini yapmis oluruz.

Iki butonun tiklama sonucunda gerceklestirmesini istedigimiz olaylarin tek bir presedur icerisinde tanimlamak icin sender strandart degiskeni kullanilir. ikinci butonun click eventina button birin prosedur adini ( button1_Click ) yazmaliyiz.

Ornek:

{
if (sender == button1)
{
MessageBox.Show(”button1″);
}
else if (sender == button2)
{
MessageBox.Show(”buton2″);
}

{
Char Deger;
Byte Bit, KarakterAscii;
Deger = Convert.ToChar(textBox1.Text);
KarakterAscii = (byte)Deger;
for (int i = 0; i <= 8; i++)
{
Bit = (byte)(KarakterAscii >> i & 1);
textBox2.Text += Bit.ToString();
}
}

« Previous PageNext Page »