Hi All,
I am new to VB .NET and i need ur advise on this ( i know this is an idiot question but i appreciate it someone can help )
HOW to Clear the records inside of a datagrid ?
TIA
regadrs
Jas
Printable View
Hi All,
I am new to VB .NET and i need ur advise on this ( i know this is an idiot question but i appreciate it someone can help )
HOW to Clear the records inside of a datagrid ?
TIA
regadrs
Jas
You can just set the datasource to nothing.
VB Code:
DataGrid1.DataSource=Nothing
i have try that datagrid.datasource=nothing but it's still cannt work.
below are my sample .net code
da.Dispose()
ds.Dispose()
'dgdResource.Refresh()
TmpRs = New ADODB.Recordset
TmpRs.Open(TmpStrSQL, gclsAdoDatabase.cnDatabase, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
If Not TmpRs.EOF Then
dgdResource.Enabled = True
da.Fill(ds, TmpRs, "list")
dgdResource.DataSource = ds
dgdResource.DataMember = "list"
dgdResource.Refresh()
Else
dgdResource.Enabled = False
End If
TIA
dataGrid.DataSource = nothing should work.
BTW get rid of the ADO code, and start learning ADO.NET
thx,,will take ur advise learned ado.net