O’zbekiston respublikasi oliy va o’rta maxsus ta’lim vazirligi qarshi Davlat Universiteti




Download 2,5 Mb.
bet9/10
Sana23.05.2024
Hajmi2,5 Mb.
#251450
1   2   3   4   5   6   7   8   9   10
Bog'liq
Kinoteatr tizimi. Bo’sh joylarni aniqlash va bilet sotish dasturini yaratish

Dastur kodi:

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 kinoteatr


{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{
this.biletlarTableAdapter.Fill(this.biletlarbazasiDataSet.biletlar);
biletlarBindingSource.DataSource = this.biletlarbazasiDataSet.biletlar;
label3.Text = ((this.dataGridView1.Rows.Count)-1).ToString();
}

private void button1_Click(object sender, EventArgs e)


{
if (MessageBox.Show("Biletni sotmoqchimisiz ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
biletlarBindingSource.RemoveCurrent();
}
}

private void button2_Click(object sender, EventArgs e)


{
biletlarBindingSource.EndEdit();
biletlarTableAdapter.Update(this.biletlarbazasiDataSet.biletlar);
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{

if (e.KeyChar == (char)13)


{
if (string.IsNullOrEmpty(textBox1.Text))
{
dataGridView1.DataSource = biletlarBindingSource;
}
else
{
var quuery = from o in this.biletlarbazasiDataSet.biletlar
where o.Biletga_mos_joy.Contains(textBox1.Text)
select o;
dataGridView1.DataSource = quuery.ToList();
}
}
}

private void dataGridView1_KeyDown(object sender, KeyEventArgs e)


{
if (e.KeyCode == Keys.Enter)
{
if (MessageBox.Show("Biletni sotmoqchimisiz ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
biletlarBindingSource.RemoveCurrent();
}
}
}

private void dataGridView1_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)


{
label3.Text = this.dataGridView1.Rows.Count.ToString();
}
}
}


Download 2,5 Mb.
1   2   3   4   5   6   7   8   9   10




Download 2,5 Mb.

Bosh sahifa
Aloqalar

    Bosh sahifa



O’zbekiston respublikasi oliy va o’rta maxsus ta’lim vazirligi qarshi Davlat Universiteti

Download 2,5 Mb.