Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want listbox in datragridview so i used a new control i.e datagridview with listbox control.... now when i enter text in datagridview column the listbox will become visible... i want the cursor should point to a value from listbox if i press up & down keys....
Posted

1 solution

This may help you. Add this code into a SelectionChanged handler for the DataGridView control. It isn't perfect, but it might get you on your way.
C#
Point cellAddress = dgData.CurrentCellAddress;
Rectangle cell = dgData.GetCellDisplayRectangle(0, cellAddress.Y, false);
int x = Left + dgData.Left + cell.Left;
int y = Top + dgData.Top + cell.Y + (cell.Height * 2);
Cursor.Position = new Point(x,y);            
 
Share this answer
 

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