1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| ' Debut partie test
' Création de la Table
Dim dt As New DataTable
dt.Columns.Add("id", GetType(Integer))
dt.Columns.Add("numero", GetType(String))
dt.Columns.Add("nom", GetType(String))
' Fill de la table
dt.Rows.Add(1, "83", "VAR")
dt.Rows.Add(2, "C83", "HYERES")
dt.Rows.Add(3, "C83", "SAINTE-MAXIME")
dt.Rows.Add(4, "C83", "LA CRAU")
'If dt.Rows.Count > 0 Then MsgBox("> 0 ok")
' j'ai bien le msgbox comme quoi j'ai dt.Row > 0
'Dim ds = dt.AsEnumerable.Where(Function(x As DataRow) x.Item(1).ToString.StartsWith("C")).ToList
Dim ds = (From dr As DataRow In dt.AsEnumerable
Where dr.Item(1).ToString.ToUpper.StartsWith("C")
Select id = dr.Item(0), numero = dr.Item(1), nom = dr.Item(2))
'If ds.Count = 0 Then MsgBox("trop filtré !")
' ici pas de msgbox ce qui implique que le count du filtrage est > 0
dgv.DataSource = ds.ToList
'Exit Sub
' Fin Partie Test |