troubleshooting Question

Refresh data in a Bound datagridview VB.NET

Avatar of andyd70
andyd70Flag for Australia asked on
Visual Basic.NET
3 Comments1 Solution1675 ViewsLast Modified:
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 ???

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 3 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 3 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004