C# Archives - Tech Insights https://reactconf.org/category/how-to-binding-arraylist-to-listview-in-c/ Unveiling Tomorrow's Tech Today, Where Innovation Meets Insight Sun, 05 Oct 2014 17:01:00 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 https://i0.wp.com/reactconf.org/wp-content/uploads/2023/11/cropped-reactconf.png?fit=32%2C32&ssl=1 C# Archives - Tech Insights https://reactconf.org/category/how-to-binding-arraylist-to-listview-in-c/ 32 32 230003556 How to Binding Arraylist to Listview in c# https://reactconf.org/how-to-binding-arraylist-to-listview-in/ https://reactconf.org/how-to-binding-arraylist-to-listview-in/#comments Sun, 05 Oct 2014 17:01:00 +0000 http://www.sqlneed.com/2014/10/05/how-to-binding-arraylist-to-listview-in-c/ In this article I will explain how to binding array list to C# listview. First you need to create New Project and Name of project is DisplayArrayListToListview, and Add the …

The post How to Binding Arraylist to Listview in c# appeared first on Tech Insights.

]]>
In this article I will explain how to binding array list to C# listview.


First you need to create New Project and Name of project is DisplayArrayListToListview, and Add the Command button and ListView control and copy this code and paste.
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Collections;
namespaceDisplayArrayListToListview
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private voidCmdArrList_Click(object sender, EventArgs e)
        {
            
            //Multi Dimensional Array
            string[,] ArrayList ={
                                {“101”,“John”,“5000”},
                                {“102”,“Ajay”,“8000”},
                                {“103”,“Fleming”,“10000”}
                                 };
           
           
            listView1.Items.Clear();
          
                for(inti=0;i<3;i++)
            {
                ListViewItem lv = newListViewItem();
                lv.Text = ArrayList[i, 0];
                lv.SubItems.Add(ArrayList[i, 1]);
                lv.SubItems.Add(ArrayList[i, 2]);
           
                listView1.Items.Add(lv);
            }
          
        }
        private voidForm1_Load(object sender, EventArgs e)
        {
            listView1.GridLines = true;
            listView1.View = View.Details;
            //Add Column Header
            listView1.Columns.Add(“ID”, 50);
            listView1.Columns.Add(“Name”, 50);
            listView1.Columns.Add(“Salary”, 50);
        }
    }
}

The post How to Binding Arraylist to Listview in c# appeared first on Tech Insights.

]]>
https://reactconf.org/how-to-binding-arraylist-to-listview-in/feed/ 1 37