top of page
Ara

Form Application Sayısal Loto Yapımı

  • ByAdmin
  • 21 Ara 2015
  • 1 dakikada okunur

Bildiğiniz Gibi Sayısal Lotoda 1'le 50 Arası Toplar Çekilir.6 Sayıyı Bilen Büyük İkramiyeyi Alır C# İse Bunu Random Sayı Belirleyerek Yani Bilgisayarın Kendisini Sayı Üretmesini Sağlayarak YApılır...

Kodlar:

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 WFA_SayisalLoto { public partial class Form1 : Form { public Form1() { InitializeComponent(); //www.sametmedya.com } Random rnd = new Random(); private void btnOyna_Click(object sender, EventArgs e) {

//for (int i = 0; i < this.Controls.Count; i++) //{

// if (this.Controls[i] is ListBox) // { // ListBox list = (ListBox)this.Controls[i]; // list.Items.Clear();

// for (int j = 0; j < 6; ) // { // int sayi = rnd.Next(1, 50); // if (!list.Items.Contains(sayi)) // { // list.Items.Add(sayi); // j++; // }

// } // } //} //www.Sametmedya.com foreach (var item in this.Controls) { if (item is ListBox) {

ListBox lst = (ListBox)item; lst.Items.Clear();

for (int j = 0; j < 6; ) { int sayi = rnd.Next(1, 50); if (!lst.Items.Contains(sayi)) { lst.Items.Add(sayi); j++; } } } } }

private void Form1_Load(object sender, EventArgs e) {

} } }

Comments


Tanıtılan Yazılar
Son Paylaşımlar
Arşiv
Etiketlere Göre Ara
Bizi Takip Edin
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page