İndirmek için Tıklayın...
BUTTON
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;
using System.Data.OleDb;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int a = 0;
int k=0;
int s = 0;
OleDbConnection emir = new
OleDbConnection("Provider=microsoft.ace.oledb.12.0;data
source=e.accdb");
private void
button14_Click(object sender, EventArgs e)
{
int m = 0;
emir.Open();
OleDbDataAdapter emir2 = new
OleDbDataAdapter("select*from
emir", emir);
DataSet emir3 = new
DataSet();
emir2.Fill(emir3, "ş");
int z = emir3.Tables[0].Rows.Count;
for (int k = 0; k
< z; k++)
{
if (textBox3.Text ==
emir3.Tables[0].Rows[k][0].ToString())
{
m = 1;
}
}
if (m == 1)
{
MessageBox.Show("aynı No Olamaz");
}
if (m == 0)
{
panel1.Visible = true;
panel2.Visible = false;
panel3.Visible = true;
met();
OleDbCommand emir5 = new OleDbCommand("insert into emir(okulno,ad,skor) values('"
+ textBox3.Text + "','" +
textBox4.Text + "','0')", emir);
emir5.ExecuteNonQuery();
}
emir.Close();
}
private void
button1_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button1.Text);
button1.Enabled = false;
}
}
private void
button2_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button2.Text);
button2.Enabled = false;
}
}
private void
button3_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button3.Text);
button3.Enabled = false;
}
}
private void
button4_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button4.Text);
button4.Enabled = false;
}
}
private void
button5_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button5.Text);
button5.Enabled = false;
}
}
private void
button6_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button6.Text);
button6.Enabled = false;
}
}
private void
button7_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button7.Text);
button7.Enabled = false;
}
}
private void
button8_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button8.Text);
button8.Enabled = false;
}
}
private void
button9_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button9.Text);
button9.Enabled = false;
}
}
private void
button10_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button10.Text);
button10.Enabled = false;
}
}
private void
button11_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button11.Text);
button11.Enabled = false;
}
}
private void
button12_Click(object sender, EventArgs e)
{
s
= s + 1;
if (s > 3)
{
s = 0;
MessageBox.Show("En Fazla 3 Button Tıklayabilirsin");
}
else
{
a = a + Convert.ToInt32(button12.Text);
button12.Enabled = false;
}
}
private void
button13_Click(object sender, EventArgs e)
{
int b = Convert.ToInt32(textBox1.Text);
if (b == a)
{
a = 0;
k = k + 10;
textBox2.Text = k.ToString();
s = 0;
textBox1.Clear();
MessageBox.Show("Doğru Bildiniz");
me();
}
else
{
a = 0;
k = k - 5;
textBox2.Text = k.ToString();
s = 0;
textBox1.Clear();
MessageBox.Show("Yanlış Bildiniz");
me();
}
}
public void met()
{
Random em = new Random();
int c = em.Next(1, 30);
int c1 = em.Next(1, 30);
int c2 = em.Next(1, 30);
int c3 = em.Next(1, 30);
int c4 = em.Next(1, 30);
int c5 = em.Next(1, 30);
int c6 = em.Next(1, 30);
int c7 = em.Next(1, 30);
int c8 = em.Next(1, 30);
int c9 = em.Next(1, 30);
int c10 = em.Next(1, 30);
int c11 = em.Next(1, 30);
button1.Text = c.ToString();
button2.Text = c1.ToString();
button3.Text = c2.ToString();
button4.Text = c3.ToString();
button5.Text = c4.ToString();
button6.Text = c5.ToString();
button7.Text = c6.ToString();
button8.Text = c7.ToString();
button9.Text = c8.ToString();
button10.Text = c9.ToString();
button11.Text = c10.ToString();
button12.Text = c11.ToString();
}
public void me()
{
emir.Open();
OleDbCommand emir5 = new
OleDbCommand("update
emir set skor='" + textBox2.Text + "'
where okulno='" + textBox3.Text + "'",
emir);
emir5.ExecuteNonQuery();
emir.Close();
}
private void
button15_Click(object sender, EventArgs e)
{
int i=0;
emir.Open();
OleDbDataAdapter emir2 = new
OleDbDataAdapter("select*from
emir order by skor desc", emir);
DataSet emir3 = new
DataSet();
emir2.Fill(emir3, "ş");
int z = emir3.Tables[0].Rows.Count;
for (int k = 0; k
< z; k++)
{
listBox1.Items.Add(++i + ")"
+ emir3.Tables[0].Rows[k][0] + " "
+ emir3.Tables[0].Rows[k][1] + " "
+ emir3.Tables[0].Rows[k][2]);
}
}
}
}
Hiç yorum yok:
Yorum Gönder