Formun Tamamı İçin Tıklayınız.
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;
using System.Collections;
namespace WindowsFormsApplication59
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
ArrayList say = new ArrayList();
OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=okul.mdb");
int i = 0;
int limit;
int sure = 60;
string[] cevaplar = new string[101];
int g = 0;
private void button1_Click(object sender, EventArgs e)
{
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("select * from sinif", con);
DataSet ds = new DataSet();
da.Fill(ds, "pelin");
listBox1.Visible = true;
listBox1.Items.Clear();
int m=0;
for (int j = 0; j < limit; j++)
{
if (ds.Tables[0].Rows[j][6].ToString() == cevaplar[j].ToString())
{
listBox1.Items.Add(++m + ".soru DOĞRU");
}
else
{
listBox1.Items.Add(++m + ".soru YANLIŞ");
}
}
con.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("select * from sinif", con);
DataSet ds = new DataSet();
da.Fill(ds, "pelin");
label1.Text = ds.Tables[0].Rows[i][1].ToString();
radioButton1.Text = ds.Tables[0].Rows[i][2].ToString();
radioButton2.Text = ds.Tables[0].Rows[i][3].ToString();
radioButton3.Text = ds.Tables[0].Rows[i][4].ToString();
radioButton4.Text = ds.Tables[0].Rows[i][5].ToString();
timer1.Start();
con.Close();
}
private void timer1_Tick(object sender, EventArgs e)
{
sure -= 1;
label2.Text = sure.ToString();
if (sure == 0)
{
timer1.Stop();
}
}
private void button2_Click(object sender, EventArgs e)
{
i += 1;
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("select * from sinif", con);
DataSet ds = new DataSet();
da.Fill(ds, "pelin");
limit = ds.Tables[0].Rows.Count;
if (i >= limit)
{
MessageBox.Show("Sorular bitti kontrol et...");
i = limit-1;
}
else
{
label1.Text = ds.Tables[0].Rows[i][1].ToString();
radioButton1.Text = ds.Tables[0].Rows[i][2].ToString();
radioButton2.Text = ds.Tables[0].Rows[i][3].ToString();
radioButton3.Text = ds.Tables[0].Rows[i][4].ToString();
radioButton4.Text = ds.Tables[0].Rows[i][5].ToString();
g += 1;
}
con.Close();
}
private void button3_Click(object sender, EventArgs e)
{
i -= 1;
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("select * from sinif", con);
DataSet ds = new DataSet();
da.Fill(ds, "pelin");
if (i <= -1)
{
MessageBox.Show("Zaten ilk sorudasın... ??????");
i = 0;
}
else
{
label1.Text = ds.Tables[0].Rows[i][1].ToString();
radioButton1.Text = ds.Tables[0].Rows[i][2].ToString();
radioButton2.Text = ds.Tables[0].Rows[i][3].ToString();
radioButton3.Text = ds.Tables[0].Rows[i][4].ToString();
radioButton4.Text = ds.Tables[0].Rows[i][5].ToString();
g -= 1;
}
con.Close();
}
private void button4_Click(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
cevaplar[g] = "1";
}
if (radioButton2.Checked)
{
cevaplar[g] = "2";
}
if (radioButton3.Checked)
{
cevaplar[g] = "3";
}
if (radioButton4.Checked)
{
cevaplar[g] = "4";
}
}
}
}
Hiç yorum yok:
Yorum Gönder