Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- namespace WykopTest
- {
- public partial class Form1 : Form
- {
- private readonly List<string> firstList;
- private readonly List<string> secondList;
- private int _actualList = 1;
- public Form1()
- {
- firstList = new List<string> {"AAAA", "BBBB"};
- secondList = new List<string> {"CCCC", "DDDD"};
- InitializeComponent();
- AddItems(listView1, firstList);
- }
- private void AddItems(ListView list, IEnumerable<string> items)
- {
- list.Items.Clear();
- foreach (var item in items)
- {
- list.Items.Add(item);
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (_actualList == 1)
- {
- AddItems(listView1, secondList);
- _actualList = 2;
- }
- else
- {
- AddItems(listView1, firstList);
- _actualList = 1;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement