DataGridView Not Refreshing Windows Form VB.Net

  • Thread starter Thread starter MSVBDev0978
  • Start date Start date
M

MSVBDev0978

Guest
I have a Datagridview that I am programmatically tying to a
DataSoruce. I add a row to the database table. I call this segment below (all
variables declared). It does not refresh the Datagridview . If I restart the
application on the initial load, it works fine . I did some searches on
re-binding, but not having too much luck.


Any Ideas?

I have tried adding in the statements in Bold

Public Shared Sub LoadData(obj As DataGridView)

Dim sql As String = "Select
... Statement'
<o:p></o:p>

Try

obj.Clear()

obj.DataSource = Nothing

obj.Refresh()

Dim Adpt As New OracleDataAdapter(sql,
conn)


Dim ds As New DataSet

Adpt.Fill(ds, "TableName")

obj.DataSource = ds.Tables(0)

obj.Refresh()

Continue reading...
 
Back
Top