Is it possible to disable cursor moving from cell to cell in datagridview?
Printable View
Is it possible to disable cursor moving from cell to cell in datagridview?
I would think so. When they press tab, set the active cell to the cell at 0,0. same with click.
you would handle the cell click event and the key press event of the datagridview.
To set the current cell,(e.g) Datagridview1.CurrentCell = DataGridView.Rows(0).Cells(0)
Justin
As stated, your request doesn't really make much sense. Could you please provide a FULL and CLEAR explanation of EXACTLY what you're trying to achieve and, just as importantly, why? If you're lazy when posting and try to save yourself a few seconds by making your post as short as possible then you end up wasting lots of your time and ours as we go back and forth trying to work out what you actually want when you could have just told us properly in the first place.
Sorry, here is more detail.
I added button at first column of datagridview. Some user like using tab key to move cursor. What I want is to make cursor only stay at first column and moving form first row to last row. I do no want user using tab key to move any cell other than first column.
So you don't really want to disable the cursor moving from cell to cell at all, do you? You actually want to prevent the cursor leaving the first column, right? For future reference, if you don't tell us what you actually want then we can't really tell you how to achieve it.
I think a bit of experimentation is in order. I'll get back to you.
I did something like this. I had a payment input column as a last column on a datagridview. I just started with a variable set to zero. and when they pressed tab, I caught it, incremented my variable by 1, and set the currentcell as the one at (variable,lastcolumn). If the variable's value was equal to the rows.count -1, then I set the variable back to zero (looping within the same column).
Justin