private void LoadItemData() { try { string strGroupCode = string.Empty; ListView.SelectedListViewItemCollection items = this.lstGroup.SelectedItems; foreach (ListViewItem item in items) { strGroupCode = item.SubItems[0].Name; break; } if (strGroupCode != string.Empty) { Products clsProduct = new Products(); System.Data.DataTable dt; if (mboShowInActiveProducts == false) { dt = clsProduct.SearchSaleableDataTableByGroup(strGroupCode, string.Empty, "ProductCode", SortOption.Ascending, 0, mboShowItemMoreThanZeroQty); } else { dt = clsProduct.SearchDataTableActiveInactive(ProductListFilterType.ShowInactiveOnly, strGroupCode, "ProductCode", SortOption.Ascending, 0, mboShowItemMoreThanZeroQty); } clsProduct.CommitAndDispose(); lstItems.Items.Clear(); int iImgCtr = 0; foreach (System.Data.DataRow dr in dt.Rows) { if (mboIsPriceInq) lstItems.Items.Add(dr["Barcode"].ToString(), "[" + dr["Price"].ToString() + "]" + Environment.NewLine + dr["ProductCode"].ToString(), iImgCtr); else lstItems.Items.Add(dr["Barcode"].ToString(), dr["ProductCode"].ToString(), iImgCtr); if (iImgCtr == 7) iImgCtr = 0; else iImgCtr++; } try { lstItems.Items[0].Selected = true; } catch { } } } catch (IndexOutOfRangeException){} catch (Exception ex) { MessageBox.Show(ex.Message,"RetailPlus",MessageBoxButtons.OK,MessageBoxIcon.Error); } }