Results 1 to 8 of 8

Thread: Disable tha highlightning

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2010
    Posts
    83

    Disable tha highlightning

    In my project I have a DataGridView with only one row. See here:



    But I have to change something. When the datagridview appears, the first cell is highlighted what I dont want, because, in this case, this is confusing.
    Is there any possibility to disable this highlight?
    Thanks in advance.
    Onenew

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Disable tha highlightning

    Set the focus on a different control when the form opens.

    Typically I use the ever present "Cancel" or "Close" button.

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

    Re: Disable tha highlightning

    That would indicate that your DataGridView is first in the Tab order, so it gets focus when the form opens. Change the Tab order so it's not first.
    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
    Lively Member
    Join Date
    Oct 2010
    Posts
    83

    Re: Disable tha highlightning

    Hi, jmcilhinney and Hack,
    I set the TabIndex for DataGridView to 99 , set another textbox to focus or select, but still is the same case.
    Onenew

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

    Re: Disable tha highlightning

    Well, you wouldn't set the TabIndex to 99 for a start. Simply click the Tab Order button on the tool bar and then click the controls in the order you want them.

    Try setting the grid's CurrentCell to Nothing in the form's Shown event handler.
    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

    Thread Starter
    Lively Member
    Join Date
    Oct 2010
    Posts
    83

    Re: Disable tha highlightning

    jmcilhinney,
    That way nothing is accomplished.
    Does anyone know how to do it?
    Onenew

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Disable tha highlightning

    Quote Originally Posted by Onenew View Post
    I set the TabIndex for DataGridView to 99 , set another textbox to focus or select, but still is the same case.
    Set the Tabindex of the textbox you selected to 0

    That is the only tabindex you need to worry about.

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

    Re: Disable tha highlightning

    Quote Originally Posted by Onenew View Post
    jmcilhinney,
    That way nothing is accomplished.
    Does anyone know how to do it?
    Onenew
    I tested it and it worked, so you did something wrong.
    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

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