Results 1 to 6 of 6

Thread: Disable cursor moving from cell to cell in datagridview

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Disable cursor moving from cell to cell in datagridview

    Is it possible to disable cursor moving from cell to cell in datagridview?

  2. #2
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: 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
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Disable cursor moving from cell to cell in datagridview

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2010
    Posts
    478

    Re: Disable cursor moving from cell to cell in datagridview

    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.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Disable cursor moving from cell to cell in datagridview

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: Disable cursor moving from cell to cell in datagridview

    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
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width