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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Finding in datagridview

Finding in datagridview

Scheduled Pinned Locked Moved C#
algorithmstutorialquestion
4 Posts 4 Posters 1 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
    ArielR
    wrote on last edited by
    #1

    Which is the elemental code for searching in a datagridview column?. How to give the focus at the row with the value found?

    P N W 3 Replies Last reply
    0
    • A ArielR

      Which is the elemental code for searching in a datagridview column?. How to give the focus at the row with the value found?

      P Offline
      P Offline
      Pedram Behroozi
      wrote on last edited by
      #2

      Not sure what you're trying to do but you don't need to search into Columns, you can simply search in Rows:

      DataGridView dgv = new DataGridView();
      DataGridViewRow dgvr = new DataGridViewRow();
      dgvr.Cells[0].Value = "Hello!"; // Or anyting that you want to search (not only Strings, not only Zero)

      dgv.Rows[dgv.Rows.IndexOf(dgvr)].Selected = true;

      While (true) { Human.isLearnable = true; }

      1 Reply Last reply
      0
      • A ArielR

        Which is the elemental code for searching in a datagridview column?. How to give the focus at the row with the value found?

        N Offline
        N Offline
        nelsonpaixao
        wrote on last edited by
        #3

        You can do that with sql procedures, after trigger it in a c# event :wtf:

        nelsonpaixao@yahoo.com.br trying to help & get help

        1 Reply Last reply
        0
        • A ArielR

          Which is the elemental code for searching in a datagridview column?. How to give the focus at the row with the value found?

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          AFAIK the searching should be implemented at data source level. If you're using BindingSource as datasource, have a look at BindingSource.Find Method (String, Object)[^]

          The need to optimize rises from a bad design

          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