NATIJA
Slayd
namespace Shohrux
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{int k=0;
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void MainFormLoad(object sender, EventArgs e)
{
}
void Button1Click(object sender, EventArgs e)
{switch (k)
{
case 0:
pictureBox1.Image=Image.FromFile("d:\\KKK\\1.jpg"); k++;break;
case 1:
pictureBox1.Image=Image.FromFile("d:\\KKK\\2.jpg"); k++;break;
case 2:
pictureBox1.Image=Image.FromFile("d:\\KKK\\3.jpg"); k++;break;
default:MessageBox.Show("dastur tugadi");break;}
}
void PictureBox1Click(object sender, EventArgs e)
{
}
void Button2Click(object sender, EventArgs e)
{switch (k)
{
case 3:
pictureBox1.Image=Image.FromFile("d:\\KKK\\3.jpg"); k--;break;
case 2:
pictureBox1.Image=Image.FromFile("d:\\KKK\\2.jpg"); k--;break;
case 1:
pictureBox1.Image=Image.FromFile("d:\\KKK\\1.jpg"); k--;break;
default:MessageBox.Show("dastur tugadi");break;}
}
}
}
Natija
TALABALAR BAZASI
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 BazagaKirish
{
public partial class Form1 : Form
{
Query controller;
public Form1()
{
InitializeComponent();
controller = new Query(ConnectionString.ConnStr);
}
private void button1_Click(object sender, EventArgs e)
{
try
{
if (textBox1.Text == "" && textBox1.Text == " ")
{
MessageBox.Show("Iltimos Ismngizni kiriting!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (textBox2.Text == "" && textBox2.Text == " ")
{
MessageBox.Show("Iltimos Familyangizni kiriting!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (textBox3.Text == "" && textBox3.Text == " ")
{
MessageBox.Show("Iltimos Otasini ismini kiriting!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (comboBox1.Text == "" && comboBox1.Text == " ")
{
MessageBox.Show("Iltimos Millatizni kiriting!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (textBox4.Text == "" && textBox4.Text == " ")
{
MessageBox.Show("Iltimos Tugilgan_yilingizni kiriting!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (textBox5.Text == "" && textBox5.Text == " ")
{
MessageBox.Show("Iltimos Manzilizni kiriting!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (textBox6.Text == "" && textBox6.Text == " ")
{
MessageBox.Show("Iltimos Qaysi+fandan_dars_beradi kirgizing !!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (textBox7.Text == "" && textBox7.Text == " ")
{
MessageBox.Show("Iltimos telefon_nomerizni kiriting kiriting!!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
MessageBox.Show("Bazaga Muvofaqiyatli qushdingiz", "HURMAT BILAN BAZA YARATUVCHISI GADOYJONOV SHOHRUX", MessageBoxButtons.OK, MessageBoxIcon.Information);
controller.Add(textBox1.Text, textBox2.Text, textBox3.Text, comboBox1.Text, textBox4.Text, textBox5.Text, textBox6.Text,textBox7.Text);
dataGridView1.DataSource = controller.UpdateTalabalar();
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
comboBox1.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox7.Text = "";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.DataSource = controller.UpdateTalabalar();
}
}
}
Query
using System.Data;
namespace BazagaKirish
{
class Query
{
OleDbConnection connection;
OleDbCommand command;
OleDbDataAdapter dataAdapter;
DataTable table;
public Query(string Conn)
{
connection = new OleDbConnection(Conn);
table = new DataTable();
}
public DataTable UpdateTalabalar()
{
connection.Open();
dataAdapter = new OleDbDataAdapter("SELECT * FROM Talabalar", connection);
table.Clear();
dataAdapter.Fill(table);
connection.Close();
return table;
}
public void Add(string Ism, string Familya, string Otasini_ismi, string Millati, string Tugilgan_yil, string Manzili, string Qaysi_fandan_dars_beradi, string Telefon_nomer)
{
connection.Open();
command = new OleDbCommand("INSERT INTO Talabalar(Ism, Familya, Otasini_ismi, Millati, Tugilgan_yili, Manzili, Qaysi_fandan_dars_beradi, Telefon_nomer) VALUES (@Ism, @Familya, @Otasini_ismi, @Millati, @Tugilgan_yili, @Manzili, @Qaysi_fandan_dars_beradi, @Telefon_nomer)", connection);
command.Parameters.AddWithValue("ism", Ism);
command.Parameters.AddWithValue("Familya", Familya);
command.Parameters.AddWithValue("Otasini_ismi", Otasini_ismi);
command.Parameters.AddWithValue("Millati", Millati);
command.Parameters.AddWithValue("Tugilgan_yili", Tugilgan_yil);
command.Parameters.AddWithValue("Manzili", Manzili);
command.Parameters.AddWithValue("Qaysi_fandan_dars_beradi", Qaysi_fandan_dars_beradi);
command.Parameters.AddWithValue("Telefon_nomer", Telefon_nomer);
command.ExecuteNonQuery();
connection.Close();
}
}
}
NATIJA
MUSIC PLAYER
namespace MUSIC_PLEYER
{
public partial class MusicPlayer : Form
{
public MusicPlayer()
{
InitializeComponent();
}
string[] paths, files;
private void label1_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnSelectSongs_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Multiselect = true;
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
files = ofd.SafeFileNames;
paths = ofd.FileNames;
for (int i = 0; i < files.Length; i++)
{
listBoxSongs.Items.Add(files[i]);
}
}
}
private void listBoxSongs_SelectedIndexChanged(object sender, EventArgs e)
{
axWindowsMediaPlayerMusic.URL = paths[listBoxSongs.SelectedIndex];
}
}
}
Do'stlaringiz bilan baham: |