Opinion? Reusing Control Resources...

D

dwhittenburg

I've got about 3 or 6 pieces of data that is of similar type...I created a
TabControl and am going to show each pieces of data in a DataGrid on each of
the TabPage...

My question is...would it be better to keep one DataGrid and reload the data
in the DataGrid on each TabPage or is it better to just create a DataGrid
for each TabPage...

Just wanted an opinion here...


The reason I ask is I'm having trouble after setting the DataGrid to the
Controls.Add of the TabPage, the TabPage is not refreshing to show the
contents...If I display a message box when I change the TabPage I can see
what is behind the msgbox, but it is like the TabPage is not refreshing to
show me the contents automatically...

I've tried several things below...


Me.TCFacesheet.TabPages(TCFacesheet.SelectedIndex).Controls.Add(dgFacesheet)

dgFacesheet.Refresh()

Me.TCFacesheet.TabPages(TCFacesheet.SelectedIndex).Refresh()

Me.TCFacesheet.TabPages(TCFacesheet.SelectedIndex).Update()
 
D

Daniel Moth

I don't think you need explicit calls to refresh/update etc

Try before adding the datagrid control to the new tabpage, setting its
parent to nothing. E.g.:
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles TabControl1.SelectedIndexChanged
DataGrid1.Parent = Nothing
TabControl1.TabPages.Item(TabControl1.SelectedIndex).Controls.Add(DataGrid1)End SubCheersDaniel--http://www.danielmoth.com/Blog/"dwhittenburg" <[email protected]> wrote in messageI've got about 3 or 6 pieces of data that is of similar type...I created a> TabControl and am going to show each pieces of data in a DataGrid on each> of the TabPage...>> My question is...would it be better to keep one DataGrid and reload the> data in the DataGrid on each TabPage or is it better to just create a> DataGrid for each TabPage...>> Just wanted an opinion here...>>> The reason I ask is I'm having trouble after setting the DataGrid to the> Controls.Add of the TabPage, the TabPage is not refreshing to show the> contents...If I display a message box when I change the TabPage I can see> what is behind the msgbox, but it is like the TabPage is not refreshing to> show me the contents automatically...>> I've tried several things below...>>>Me.TCFacesheet.TabPages(TCFacesheet.SelectedIndex).Controls.Add(dgFacesheet)>> dgFacesheet.Refresh()>> Me.TCFacesheet.TabPages(TCFacesheet.SelectedIndex).Refresh()>> Me.TCFacesheet.TabPages(TCFacesheet.SelectedIndex).Update()>>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top