C Sharp � Form � Girilen Mesaj�
Girilen Say� Kadar Yazd�rma
Bu �rnekte kullan�c�dan bir mesaj ald�ktan sonra 1�den ba�layarak kullan�c�n�n girdi�i say�ya kadar mesaj� yazd�r�yoruz. Kullan�c�dan ald���m�z mesaj� ve mesaj adetini de�i�kene atay�p daha sonra for d�ng�s� kullanarak messagebox�a yazd�r�yoruz.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Girilen_Mesaj�_�stenildi�i_Kadar_Yazd�rma { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click( object sender, EventArgs e) { string mesaj = Convert.ToString(textBox1.Text); //Mesaj de�i�kenimizi belirlirleyip textbox1'e girilen mesaj� de�i�kene at�yoruz. int mAdet = Convert.ToInt16(textBox2.Text); //Mesaj adeti de�i�kenimizi belirleyip textbox2'ye girilen mesaj� de�i�kene at�yoruz. for ( int i = 1 ; i <= mAdet; i++) //girilen say�ya kadar d�nen d�ng� olu�turuyoruz. { MessageBox.Show(+i + "-" +mesaj); //Mesaj� messagebox'a yazd�r�yoruz. } } } } |
Yorum Gönder