Wednesday, 22 May 2013

Auto complete Extender in a textbox in window Application

        private void StoreRoomBM_Load(object sender, EventArgs e)
        {
            autoItem();
        }
//Create a method Which name is Auto Item  and after that that method calls in Page Load Event
void AutoItem()
        {
            try
            {
                AutoCompleteStringCollection autocomp = new AutoCompleteStringCollection();
                List<POS_ManagerBrandDetails> ListItem = new List<POS_ManagerBrandDetails>();
                ListItem = ERPManagement.GetInstance.AllItemDetails();
                for (int i = 0; i < ListItem.Count; i++)
                {
                    autocomp.Add(ListItem[i].ItemName);
                    TxtBrand.AutoCompleteMode = AutoCompleteMode.Suggest;
                    TxtBrand.AutoCompleteSource = AutoCompleteSource.CustomSource;
                    TxtBrand.AutoCompleteCustomSource = autocomp;
                }
            }
            catch (Exception ex)
            {
            }
        }

No comments:

Post a Comment