Reputation: 4294
I have multiple results sets coming back from a server request against a datasource. I want to organise these with a WinForms tabPage for each result set, on a single tabControl. I am displaying the data in a DataGridView, but want to avoid having a DataGridView instance on each tabPage - I'd rather intercept the "switching to new tab page" message, and load up the appropriate results set from my local cache. Is there an easy/obvious way to do this?
Upvotes: 2
Views: 4757
Reputation: 1
Sub AddDGVInTab(Form As Control, DGV As DataGridView)
Form.Controls.Add(DGV)
DGV.BringToFront()
End Sub
Use this procedure on Click, Texchange Events
Upvotes: 0
Reputation: 22378
Create a tab control as usual and then put a DataGridView on top of it (be sure not to put it inside a tab page).
Subscribe to the SelectedIndexChanged event and reload the data when the event fires.
Upvotes: 2
Reputation: 185703
Why would you want to do this? You'd lose the designability per result set (unless they're all the same structure) and have to manage all of this yourself.
Upvotes: 0