Bonjour,

J'aimerais obtenir un datatable depuis le datasource d'une gridview :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
Dim Table As DataTableCollection = DsGrid.Tables
                BindSource.DataSource = Table(0)
                BindSource.Filter = "Nom LIKE '" & SearchNom & "'
Me.DataGridViewVisiteur.DataSource = BindSource                
                Dim dt as datatable = CType(Me.DataGridViewVisiteur.DataSource, DataTable)
J'obtient le message :
Unable to cast object of type 'System.Windows.Forms.BindingSource' to type 'System.Data.DataTable'.
Comment faire ?
merci.