hello everyone i'm creating billing application in that i got the two problem while i'm use.
1)when i came in purchase form i can retrive all the supplier's name in the one genral list box list. but i want when i came in textbox for typing the name of supplier name i want to show the index of the list should be move when i preesed the perticuler worl. for e.g.(in list there is name 'abcd','efgh','jklm','mnop' when i comes in textbox and enter 'm' then index of the list shuold be chnged from 0 to 3. and as per the words enter in textbox).

2) and another is gridview which shows one combo box which have list of all the product and one textbox where i can eneter the quantity,rate and it should be move from one column to another after every enter event and show the total and combox box and textbox comes next column.
please help me it's urgen.

Hi there.
Here is a possible solution for your first problem.
When the text changes in the textBox1:it gets the most similar item to the one in the textbox from the listbox and puts that item to the 1st row(in the listbox), the 1 which was in the first row changes place with the one which got to the 1st row.
Required elements: 1 listbox (listBox1), 1 textbox (textbox1)

private void textBox1_TextChanged(object sender, EventArgs e)
        {
            // the strings in the array
            string[] lbl = getlbl();
            // textbox's text
            string txxtt = textBox1.Text;
            //if there is txxtt in the list box than retieves it's index
            int index = findd(lbl,txxtt,false);
            //theese are pretty obvious
            string[] endy = lbl;
            string y = lbl[index];
            endy[index] = lbl[0];
            endy[0] = y;
            slbi(endy);
          }
        private string[] getlbl()
        {// get list box items
            int c = listBox1.Items.Count;
            string[] its = new string[c];
            //put lisbox's items to the array (its)
            listBox1.Items.CopyTo(its, 0);
            return its;
        }
        private void slbi(string[] inp)
        {//set items
        listBox1.Items.Clear();
        listBox1.Items.AddRange(inp);
        }
        private int findd(String[] arr,string lf,bool flm)
        {// arr: array to look in lf: string to find bool: full match
            int hp1 = 0;
            while (hp1 < arr.Length)
            {
                if (flm)
                {
                    if (arr[hp1] == lf)
                    {
                        return hp1;
                    }
                }
                if (!flm)
                {
                    if (arr[hp1].IndexOf(lf)== 0)
                    {
                        return hp1;
                    }             
                }
                hp1++;
            }
            return 0;
        }
    }
}

I hope this helps...
And about your second problem,unfortunately i wasn't abale to understand what you wrote so please try to explain it a bit further.
Happy Coding!
Andrew

Okay,write your experinces 'bout it. ^^
And if you could,explain your second problem a bit further.

Andrew

This article has been dead for over six months. Start a new discussion instead.