Advertisement
Guest User

Untitled

a guest
May 27th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace WindowsFormsApplication1
  11. {
  12.     public partial class Form2 : Form
  13.     {
  14.         List<string> namen = new List<string>();
  15.         List<int> nummer = new List<int>();
  16.         List<int> alter = new List<int>();
  17.         public Form2()
  18.         {
  19.             InitializeComponent();
  20.             nummer.Add(1);
  21.             nummer.Add(2);
  22.             nummer.Add(3);
  23.             namen.Add("Hans");
  24.             namen.Add("Franz");
  25.             namen.Add("Kevin");
  26.             alter.Add(57);
  27.             alter.Add(33);
  28.             alter.Add(13);
  29.  
  30.         }
  31.         private void Form2_Load(object sender, EventArgs e)
  32.         {
  33.  
  34.         }
  35.         private void button1_Click(object sender, EventArgs e)
  36.         {/*
  37.             ListViewItem a = new ListViewItem("1");
  38.             a.SubItems.Add("Hans");
  39.             a.SubItems.Add("57");
  40.             ListViewItem b = new ListViewItem("2");
  41.             b.SubItems.Add("Franz");
  42.             b.SubItems.Add("33");
  43.             ListViewItem c = new ListViewItem("3");
  44.             c.SubItems.Add("Kevin");
  45.             c.SubItems.Add("13");
  46.             listView1.Items.AddRange(new ListViewItem[] { a, b, c });
  47.             this.Controls.Add(listView1);
  48.           */
  49.             for (int a = 0; !string.IsNullOrEmpty(namen[a]); a++)
  50.             {
  51.                 ListViewItem namen[a] = new ListViewItem(a + 1);
  52.                 a.SubItems.Add(namen[a]);
  53.                 a.SubItems.Add(alter[a]);
  54.             }
  55.             int a;
  56.             listView1.Items.AddRange(new ListViewItem[]
  57.             {
  58.             for ( a= 0; !string.IsNullOrEmpty(namen[a+1]); a++)
  59.             {
  60.                 namen[a],
  61.             }
  62.                 namen[a]
  63.             });
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement