От двух текстовых полей до одного listview (C#)
Hi everyone. I have two textBoxes on the form and one listView. I want to add items from textBox1.Text to Column1 in listView, and items from textBox2.Text to Column2 in listViev1. I tried the code below but it's not good enough. Picture 1 is my result. Picture 2 is as I would like it to be. How to do it. Thank you. Picture 1 https://i.postimg.cc/T33QVYWX/1.png Picture 2 https://i.postimg.cc/Mp35d2yf/3.png
Что я уже пробовал:
private void Add() { try { string[] line = textBox2.Lines; var Column2 = line.ToString(); foreach (var Column1 in textBox1.Lines) if (!listView1.Items.ContainsKey(Column1)) { listView1.Items.Add(new ListViewItem(new string[] { Column1, Column2 })); } } catch { } }