vb.netdatagridrowfilter

how can I disable rows in my gridview with datasource rowfilter?


How can I hide rows in my Gridview with a specific value? For example I want to hide all rows with column("dubletten_Vorschlaege") is empty

    skmTabelle.SLXADRIUMDEVDataSet.Tables("SKM2").DefaultView.RowFilter = "Dubletten_Vorschlaege =Nothing"

said he cant find the column nothing?

    skmTabelle.SLXADRIUMDEVDataSet.Tables("SKM2").DefaultView.RowFilter = "Dubletten_Vorschlaege ="""

said he cannot read the statement at """

I've never used rowfilter so I hope someone can explain.

Edit:
thx levi, it doesn't throw an exception now. But the gridview doesn't change. how do I do that? Do I need to use the fill query again?

on the formload event I have

Me.SKM2TableAdapter.Fillg(Me.SLXADRIUMDEVDataSet.SKM2, Module1.pkey)

which only selects the rows which are new. for example I imported new 2000 rows it only shows them. Do I need to use this statement again?


Solution

  • I would refer you to this site for a few tips on using rowfilter. http://www.csharp-examples.net/dataview-rowfilter/

    In your case, I think the proper way may be to write the string like this. I have followed a similar approach and this worked.

    ...DefaultView.RowFilter = "Dubletten_Vorschlaege ='" & "'"
    

    you will notice that i add a single quote after the = and again add a single quote within double quotes after the &.

    Also, I refer you to this StackOverflow link How do I check for blank in DataView.RowFilter The user simply added the line of code as this:

    ...DefaultView.RowFilter = "Dubletten_Vorschlaege = ''"
    

    notice the two single qoutes before the ending double quote.