Load Listview Items From INI Sections

2 posts, 0 answers
  1. Akib Hasan
    Akib Hasan avatar
    5 posts
    Member since:
    Sep 2017

    Posted 23 Sep Link to this post

         string fileName = System.IO.Path.GetFullPath("FileName.ini");
    string[] values = IniFileHelper.ReadSections(fileName);
    if (values != null)
    {
    string value = string.Join(Environment.NewLine, values);
    string[] Items = Regex.Split(value, "\r\n");
    listBox1.Items.AddRange(Items);
                   
                
               Code Showing Error when I try :      radListView1.Items.AddRange(Items);

    I also tried :

     

                
                    ListViewDataItem item = new ListViewDataItem(Items);        
                   item.Text = 
                    //item.ImageAlignment = ContentAlignment.TopCenter;
                    item.TextImageRelation = TextImageRelation.ImageBeforeText;
                    item.TextAlignment = ContentAlignment.BottomCenter;
                    item.Image = Image.FromFile("F:\\avatar_d5a3db381633_128.png");
    radListView1.Items.AddRange(Items);

     

     

    I finally Did :

     

    tring fileName = System.IO.Path.GetFullPath("FileName.ini");
    string[] values = IniFileHelper.ReadSections(fileName);
    if (values != null)
    {
    string value = string.Join(Environment.NewLine, values);
    string[] Items = Regex.Split(value, "\r\n");
    listBox1.Items.AddRange(Items);
    ListViewDataItem item = new ListViewDataItem(Items);
    item.Text = item.ToString();
    item.ImageAlignment = ContentAlignment.TopCenter;
    item.TextImageRelation = TextImageRelation.ImageBeforeText;
    item.TextAlignment = ContentAlignment.BottomCenter;
    item.Image = Image.FromFile("F:\\avatar_d5a3db381633_128.png");
    radListView1.Items.AddRange(Items);
    }

     

     

    and my inni is looki like :

    [Google]

    link=heelo

    [yahoo]

    link=yahoo.com

    etc etc etc

     

     

    I use IniFileHelper to read ini Sections...https://code.msdn.microsoft.com/windowsdesktop/Reading-and-Writing-Values-85084b6a/sourcecode?fileId=142126&pathId=731899557

     

     

  2. Akib Hasan
    Akib Hasan avatar
    5 posts
    Member since:
    Sep 2017

    Posted 23 Sep Link to this post

    I can't upload attachment. So I uploaded my sample project here : https://ufile.io/r64r2
Back to Top