textBox’a belli bir sayıdan fazla girilmesin — C#

textBox’a belli bir sayıdan fazla girilmesin — C#

[code lang=”csharp”]

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;

namespace WindowsFormsApplication13

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

try

{

if (Convert.ToInt32(textBox1.Text) > 30)

{

textBox1.Clear();

MessageBox.Show("Hatalı giriş");

}

}

catch

{

;

}

}

}

}

[/code]

Projeyi İNDİR

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir