hi guys
i am a new of programming and new of c# i try to learn it , i try to understund how work a listview , i have a file.txt inside of this , i have 4 line .
i have creted a form with a listview with 2 colums i want the even line in the txt appear in first columns and the odd in second column i try is 2 day i did do a test but not work , this is my code , any one can help me? thankz at all
listView1.View = View.Details;
listView1.Columns.Add("IP", 100);
listView1.Columns.Add("MAC", 200);
string Result = ReadZombieTxt("Zombie.txt");
if (Result == "")
{
using (StreamWriter sw = File.CreateText("Zombie.txt")) ;
}
else
{
// IList<string> list = new List<string>(Result.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries));
//string[] strarr = Result.Split(new char[] { ' ' ,'\n'}, StringSplitOptions.RemoveEmptyEntries);
///*
string[] strarr = System.Text.RegularExpressions.Regex.Split(Result, "\\r\\n");
int a = 1;
for (int i = 0; i < strarr.Length; i++)
{
// MessageBox.Show(strarr[i]);
//listView1.Items.Add(strarr[i]);//.SubItems.Add(strarr[i]);
ListViewItem item = new ListViewItem();
if (IsEven(i))
{
item.Text = strarr[i];
}
else
{
item.SubItems.Add(strarr[i]);
}
listView1.Items.Add(item);
}
// */