Ürün Satışı C#.NET(C.NET)

Ürün Satışı C#.NET(C.NET)…

urun
[code=’Csharp’]
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
checkedListBox1.Items.Add(textBox1.Text);
checkedListBox2.Items.Add(textBox2.Text);
}

private void button2_Click(object sender, EventArgs e)
{
int ind;
ind = checkedListBox1.SelectedIndex;
if (ind < 0) MessageBox.Show("Önce sileceğiniz elemanı seçin"); else { checkedListBox1.Items.RemoveAt(ind); checkedListBox2.Items.RemoveAt(ind); } } private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e) { int ind, b, t, i; //seçili elemanın indexini al ind = checkedListBox1.SelectedIndex; //Her iki listede de aynı elemanların seçili olmasını sağla checkedListBox2.SelectedIndex = ind; if (ind < 0) return; //ve işaretlerininde aynı olmasını sağla checkedListBox2.SetItemChecked(ind, checkedListBox1.GetItemChecked(ind)); //Satılan malzeme listesinden bul b = listBox1.Items.IndexOf(checkedListBox1.Items[ind]); if (b < 0)//Satılan malzeme listesinde yoksa { if (checkedListBox1.GetItemChecked(ind) == true)//ve işaretliyse { //Satılan malzeme listesine ekle listBox1.Items.Add(checkedListBox1.Items[ind]); //Fiyatını ekle listBox2.Items.Add(checkedListBox2.Items[ind]); } } if (b >= 0)//Satılan malzeme listesinde varsa
{
if (checkedListBox1.GetItemChecked(ind) == false)//ve İşaretli değilse
{
//İşareti kaldırıldıysa satılan malzeme listesinden kaldır;
listBox1.Items.RemoveAt(b);
listBox2.Items.RemoveAt(b);
}
}
//toplam fiyatı bul
t = 0;
for (i = 0; i <= listBox2.Items.Count - 1; i++) t = t + int.Parse(listBox2.Items[i].ToString()); label4.Text = t.ToString(); } private void checkedListBox2_SelectedIndexChanged(object sender, EventArgs e) { //Her iki listede de aynı elemanların seçili olmasını sağla checkedListBox1.SelectedIndex = checkedListBox2.SelectedIndex; } private void button3_Click(object sender, EventArgs e) { MessageBox.Show("En güvenilir ürünler burda. Yine bekleriz."); Close(); } }[/code]

Projeyi İNDİR

Yorumlar 1

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir