Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Is it possible to remove default selection in DataGridView?

Is it possible to remove default selection in DataGridView?

Scheduled Pinned Locked Moved Visual Basic
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andraw Tang
    wrote on last edited by
    #1

    Hi, I have a DataGridView on form, I set MultiSelect = false. By default, the DataGridView always has top left cell selected, is it possible that the DataGridView has nothing be selected by default? Thanks!

    L 1 Reply Last reply
    0
    • A Andraw Tang

      Hi, I have a DataGridView on form, I set MultiSelect = false. By default, the DataGridView always has top left cell selected, is it possible that the DataGridView has nothing be selected by default? Thanks!

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      you can undo any selection by calling ClearSelection(). What I do for DGV-based viewers that never want anything selected is add a handler (C# code alert):

      private void dgv_SelectionChanged(object sender, EventArgs e) {
      dgv.ClearSelection();
      }

      :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      A 1 Reply Last reply
      0
      • L Luc Pattyn

        you can undo any selection by calling ClearSelection(). What I do for DGV-based viewers that never want anything selected is add a handler (C# code alert):

        private void dgv_SelectionChanged(object sender, EventArgs e) {
        dgv.ClearSelection();
        }

        :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

        A Offline
        A Offline
        Andraw Tang
        wrote on last edited by
        #3

        Luc, Working great, Thank you very much.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups