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. how to find record in datagrid

how to find record in datagrid

Scheduled Pinned Locked Moved Visual Basic
databasetutorial
4 Posts 3 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.
  • S Offline
    S Offline
    Syed Ali Raza
    wrote on last edited by
    #1

    hi, A DATABASE IS RETRIEVED IN A DATAGRID then i want to use "find box" to find the record exactly the same as MS ACCESS USES. bye.

    L 1 Reply Last reply
    0
    • S Syed Ali Raza

      hi, A DATABASE IS RETRIEVED IN A DATAGRID then i want to use "find box" to find the record exactly the same as MS ACCESS USES. bye.

      L Offline
      L Offline
      Leeland
      wrote on last edited by
      #2

      I haven't worked with MS Access in a while, so I'm not sure how they do it. The easiest way to do this is to cycle through the rows until you find what you need. Dim row As DataGridViewRow For Each row In DataGridView1.Rows If row.Cells(0).Value.ToString = TextBox1.Text Then DataGridView1.CurrentCell = row.Cells(0) Exit For End If Next The 0 in the cells parameters should match whatever column you want it in. HTH

      S 1 Reply Last reply
      0
      • L Leeland

        I haven't worked with MS Access in a while, so I'm not sure how they do it. The easiest way to do this is to cycle through the rows until you find what you need. Dim row As DataGridViewRow For Each row In DataGridView1.Rows If row.Cells(0).Value.ToString = TextBox1.Text Then DataGridView1.CurrentCell = row.Cells(0) Exit For End If Next The 0 in the cells parameters should match whatever column you want it in. HTH

        S Offline
        S Offline
        Syed Ali Raza
        wrote on last edited by
        #3

        Thanks leeland but datagridviewrow is not defined , so it is showing systex error. what is datagridviewrow here.please explain.

        M 1 Reply Last reply
        0
        • S Syed Ali Raza

          Thanks leeland but datagridviewrow is not defined , so it is showing systex error. what is datagridviewrow here.please explain.

          M Offline
          M Offline
          mr_12345
          wrote on last edited by
          #4

          DataGridView is the .Net 2005 version of the DataGrid (2003). You should be able to use the same type of logic to find values in the datagrid. Mike Lasseter

          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