Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 Programiranje_domaci_3 {
- public partial class Form1 : Form {
- List<Knjiga> listKnjiga = new List<Knjiga>();
- public Form1() {
- InitializeComponent();
- }
- private void popuni() {
- Knjiga k = new Knjiga();
- k.Naziv = textBox1.Text;
- k.ImeAutora = textBox2.Text;
- k.Izdavac = comboBox1.SelectedItem.ToString();
- k.GodIzd = textBox3.Text;
- listKnjiga.Add(k);
- }
- private void button1_Click(object sender, EventArgs e) {
- popuni();
- textBox1.Clear();
- textBox2.Clear();
- comboBox1.SelectedIndex = -1;
- textBox3.Clear();
- textBox1.Focus();
- }
- private void button2_Click(object sender, EventArgs e) {
- if(!listView1.Visible) {
- foreach(Knjiga k in listKnjiga) {
- string[] s = new string[] { k.Naziv, k.ImeAutora, k.Izdavac, k.GodIzd };
- ListViewItem red = new ListViewItem(s);
- red.Tag = k;
- listView1.Items.Add(red);
- }
- listView1.Visible = true;
- }
- else
- listView1.Visible = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement