Datagrid scrolling....

G

Guest

Hi All,

i have a datagrid table that contains customers names, and a textbox which
the user enters the customer name and the datagrid's dataset is updated so
the customer name will be first. anyway i want to that user will be able also
to navigate with the down and up arrows throw the names that already
displayed. my foucus is always on the textbox (becuase if i put the focus on
the datagrid i won't be able to enter any more charachters unless i put the
focus back on the text box) and i created key event that starts when ever the
user prees and up or down buttons. my problem is that if my datagrid, for
example, contains 100 rows and only 15 displayed at the time, when the user
will navigate to row no. 16 it won't be shown unless he will scroll down the
datagrid. i would like to make that when the datagrid gets to it's last
displayed row it will scroll automaticly so i will always see the row i point
at.

it was long but i hope not too long...

thanks
 
D

Dmytro Lapshyn [MVP]

Hi,

A kind of a hack, but you can first update the grid's CurrentCell property
to force the grid to set focus to an appropriate cell and thus scroll the
cell into view, and immediately after that you can probably call
textBox.SetFocus() to return the focus to the textbox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top