I'm creating a desktop chat app in which a user can search other users by name or email. When I search other users their images are not in a sequential manner.
// This is code from Home Form
    private void BtnSearch_Click(object sender, EventArgs e)
    {
        if (Friends.SelectedIndex == 0)
        {
            UsersClass.SearchContacts(listAllContacts, ImgListAllContacts, TxtSearch.Text.Trim());
        }
    }
// This is Code from UserClass
    public static void SearchContacts(ListView listview, ImageList imagelist, string searchkey)
    {
        DataTable dt = new DataTable();
        listview.Items.Clear();
        ListViewItem[] listviewitem = null;
        dt = DataBaseAccess.Retrive("select UID,FullName,DP from TKDBUsers WHERE ( FullName+' '+UserName ) Like '%" + searchkey + "%' AND UID != '" + LogInUser.UID + "'");
        if (dt != null)
        {
            if (dt.Rows.Count > 0)
            {
                listviewitem = new ListViewItem[(dt.Rows.Count)];
                int LC = 0;        //List contacts
                foreach (DataRow item in dt.Rows)
                {
                    Image img = DataBaseAccess.Base64ToImage(Convert.ToString(item["DP"]));
                    imagelist.Images.Add(img);
                    listviewitem[LC] = new ListViewItem(new string[] { Convert.ToString(item["UID"]) + " - " + Convert.ToString(item["FullName"]) }, LC);
                    LC++;
                }
            }
        }
        if (listviewitem != null)
        {
            listview.Items.AddRange(listviewitem);
        }