I have a datagridview in a Windows Forms Vb.NET App. The datagridview is filled in the following manner.
Dim daLines As New SqlDataAdapter("Select L.CIV_LINE_ID, L.CIV_HD_ID, L.LINE_NO, L.PRODUCT_CODE from IMPORTED_CIV_LINES L WHERE L.CIV_HD_ID = '" & grdInvoiceList.CurrentRow.Cells(7).Value.ToString & "'", dbacotconn)
daLines.Fill(dslines, "LINES")
grdLines.DataSource = dslines
grdLines.DataMember = "LINES"
As I do some cell formatting the dslines is declared as a public var.
The datagridview is filled when the user selects a row in another grid.
What I have found is that the datagridview is not clearing. The results are appending to the results of the last time it was filled. I thought I would then perhaps try to delete the contents of the datagridview and re-fresh/re-read when the DA Filled the DS. I cannot get this to work.
Can anybody provide me an easier way of refreshing data in a datagridview from a Dataset ???
if not dslines is nothing then
dslines.dispose
dslines = nothing
endif
dslines = new dataset