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 ornek1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void bekle_Click(object sender, EventArgs e)
{
int vize, final;
bool kvize = Int32.TryParse(tvize.Text, out vize);
bool kfinal = Int32.TryParse(tfinal.Text, out final);
if (tadsoyad.Text.Length > 0 && kvize && kfinal)
{
if(vize>=0 && vize<=100 && final>=0 && final<=100)
{
double ort = vize * 0.4 + final * 0.6;
ladsoyad.Items.Add(tadsoyad.Text);
lvize.Items.Add(vize);
lfinal.Items.Add(final);
lort.Items.Add(ort);
tadsoyad.Clear();
tvize.Clear();
tfinal.Clear();
}
}
}
private void bsil_Click(object sender, EventArgs e)
{
int secilen = ladsoyad.SelectedIndex;
if (secilen > -1)
{
DialogResult sonuc = MessageBox.Show("Satırı silmek istediğinizden emin misiniz?",
"Uyarı", MessageBoxButtons.YesNo,
MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
if (sonuc == DialogResult.Yes)
{
ladsoyad.Items.RemoveAt(secilen);
lvize.Items.RemoveAt(secilen);
lfinal.Items.RemoveAt(secilen);
lort.Items.RemoveAt(secilen);
}
}
}
private void bcikis_Click(object sender, EventArgs e)
{
this.Close();
}
private void list_SelectedIndexChanged(object sender, EventArgs e)
{
ListBox lb = (ListBox)sender;
ladsoyad.SelectedIndex = lb.SelectedIndex;
lvize.SelectedIndex = lb.SelectedIndex;
lfinal.SelectedIndex = lb.SelectedIndex;
lort.SelectedIndex = lb.SelectedIndex;
}
}
}
GP (Güz-2016) Hafta-5/2