entity.MetaFuncs.MEStringsSelector.checkStringStart C# (CSharp) Method

checkStringStart() private method

The check string start.
private checkStringStart ( string newSel ) : void
newSel string /// The new sel. ///
return void
        private void checkStringStart(string newSel)
        {
            lbStringIDs.SuspendLayout();
            if (textBox1.Text == string.Empty)
            {
                setlbStringsIDDataSource();
                List<StringID> SIDs = getlbStringsIDDataSource();
                for (int i = 0; i < SIDs.Count; i++)
                {
                    if (SIDs[i].ToString() == newSel)
                    {
                        lbStringIDs.SelectedItem = SIDs[i];
                    }
                }
            }
            else
            {
                searchStringIDs.Clear();
                int selection = -1;
                lbStringIDs.DataSource = null;
                List<StringID> SIDs = getlbStringsIDDataSource();
                for (int i = 0; i < SIDs.Count; i++)
                {
                    string s = SIDs[i].ToString();
                    if (s.StartsWith(textBox1.Text))
                    {
                        searchStringIDs.Add(SIDs[i]);
                        if (s == newSel)
                        {
                            selection = i;
                        }
                    }
                }
                lbStringIDs.DataSource = searchStringIDs;
                if (selection != -1)
                    lbStringIDs.SelectedItem = SIDs[selection];
            }

            lbStringIDs.ResumeLayout();
        }