G
Guest
I have a form that has a Datagrid, there is a menu option that I use to
toggle the Datagrid between two different data sources (x and y). As I
continue to toggle the datagrid is duplication each data set x + x .. and y +
y ...
Is there a way to reset the datagrid?
Current config:
Private ds As DataSet = New DataSet
Private da As OleDb.OleDb.DataAdapter
Private conn as OleDb.OleDb.Connection
Private member as string
Private bolReset as boolean
Private Sub mnuViewSwitch_Click(....)
If bolReset = True then
bolReset = False
Else
bolReset = True
End if
bolError = Load_Grid(bolReset)
End Sub
Private Function Load_Grid(bolDefault as boolean)as boolean
if bolDefault = True then
strSQL = "SELECT ..."
da = New OleDb.OleDbDataAdapter(strSQL,conn)
member = "tblName"
da.Fill(ds, member)
objDataGrid.DataSource = ds.DefaultViewManager
objDataGrid.SetBindings(ds, member)
Else
'code is repeated for different strSQL
Any assistance would be greatly appreciated, Thanks.
toggle the Datagrid between two different data sources (x and y). As I
continue to toggle the datagrid is duplication each data set x + x .. and y +
y ...
Is there a way to reset the datagrid?
Current config:
Private ds As DataSet = New DataSet
Private da As OleDb.OleDb.DataAdapter
Private conn as OleDb.OleDb.Connection
Private member as string
Private bolReset as boolean
Private Sub mnuViewSwitch_Click(....)
If bolReset = True then
bolReset = False
Else
bolReset = True
End if
bolError = Load_Grid(bolReset)
End Sub
Private Function Load_Grid(bolDefault as boolean)as boolean
if bolDefault = True then
strSQL = "SELECT ..."
da = New OleDb.OleDbDataAdapter(strSQL,conn)
member = "tblName"
da.Fill(ds, member)
objDataGrid.DataSource = ds.DefaultViewManager
objDataGrid.SetBindings(ds, member)
Else
'code is repeated for different strSQL
Any assistance would be greatly appreciated, Thanks.