Click here to Skip to main content
15,897,163 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi i have
textboxs named SupplierName and ProductName
and a gridview1 the appears like intellisense

for example when i enter "s" in SupplierName the gridview1 take customer names that start with "s" from database and it is dynimically locate at the base of the current word in SupplierName textbox.

it looks fine with SupplierName textbox but the ProductName textbox is on groupbox1
and i cant locate gridview1 on groupbox1 to appear near ProductName textbox.
it only appear near SupplierName textbox even if i am entering text in ProductName textbox.

here is the code where tb is textbox parameter that take the name of textbox which is currently entered text

please someone help me solve this.
C#
int i = tb.SelectionStart;
...
  Point pt = tb.GetPositionFromCharIndex(i);
            pt.Y += (int)Math.Ceiling(tb.Font.GetHeight());
            pt.Y += 2;
            using (Graphics g = Graphics.FromHwnd(tb.Handle))
            {
                SizeF size = g.MeasureString(tb.Text, tb.Font);
                if (size.Width > tb.Width)
                {
                    // float length = size.Width % txtintellisense.Width;
                    pt.X += tb.Width;
                }
                else
                    pt.X += (int)size.Width;
            }
            Point point = tb.Location;
            pt.X += point.X;
            pt.Y += point.Y;
            this.dGVinvisible.Location = pt;
            this.dGVinvisible.BringToFront();
Posted
Updated 8-Jul-13 18:26pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900