none
Searching DataGrindView

    Question

  • so trying to search a datagridview..

    for the most part have copied the 'sample' from the help files for the table.select  method. replacing with my data info. 

    Dim table As DataTable = ImagingSystemDataSet.Tables("tblImages")
    Dim theResults() As DataRow
    Dim expression As String = "DWG_NO =" & DrwN    'evlauates to .. "DWG_NO = D-4512"
    theResults = table.Select(expression)

    if I leave the .Select() blank it will return all the rows in the dataset.. great

    replacing with the (expression) I get exception form the system.data.dll that it can not find the column D. ?? 

    not sure what's going on? My string format? method bugged?

    connected to a local SQL database.. 

    jb


    • Edited by jb 1010 Thursday, August 04, 2016 10:41 AM
    Wednesday, August 03, 2016 12:21 PM

Answers

  • yea, run out of ideas so ask.. and more solutions pop into head..

    expression = "DWN_NO = " & "'" & DrwN & "'".. 

    = "DWN_NO = 'D-4512'"  

    yes need the single quotes around the thing you look for. . 

     will be back.. :)

    jb.. 

    • Marked as answer by jb 1010 Wednesday, August 03, 2016 1:12 PM
    Wednesday, August 03, 2016 1:11 PM

All replies

  • yea, run out of ideas so ask.. and more solutions pop into head..

    expression = "DWN_NO = " & "'" & DrwN & "'".. 

    = "DWN_NO = 'D-4512'"  

    yes need the single quotes around the thing you look for. . 

     will be back.. :)

    jb.. 

    • Marked as answer by jb 1010 Wednesday, August 03, 2016 1:12 PM
    Wednesday, August 03, 2016 1:11 PM
  • ok, next.

    I can see the ObjectID, rowID in the Locals window when I break at theResults line.. 

    just How do I pull that information out so I can use it?

    it appears to link back to the datagrid line the record is on.. would go a long way to sinking the search with what the datagrid is showing. 

    it's sure seems like the datagrid is a lot dumber than the old one from vb6.. or maybe me.. 

    jb.. 

    Wednesday, August 03, 2016 3:12 PM