Tabcontrol-Windows application VB.NET

S

skumar

I need to add a datagrid in the Tabcontrol which can be
used in common by all Tabpages.

Right now i have to add datagrid to individual tabpages.

Can anyone help me in this. i just want to add one
datagrid control to tabcontrol which can be used and seen
in all tabpages.

Thanks,
SKumar
 
E

Ed Kaim [MSFT]

I'm not a VB developer, so I'm not sure how to make a better If statement
here:
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles TabControl1.SelectedIndexChanged

If (Not (Me.DataGrid1.Parent Is Nothing)) Then

Me.DataGrid1.Parent.Controls.Remove(Me.DataGrid1)

Me.TabControl1.SelectedTab.Controls.Add(Me.DataGrid1)

End If

End Sub

Anyway, it seems to work fine be handling the "OnSelectedChanged" event of
the TabControl where it removes the DataGrid from its current TabPage and
then adds it to the currently visible TabPage.
 
S

skumar

Thanks.It worked.
-----Original Message-----
I'm not a VB developer, so I'm not sure how to make a better If statement
here:
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles TabControl1.SelectedIndexChanged

If (Not (Me.DataGrid1.Parent Is Nothing)) Then

Me.DataGrid1.Parent.Controls.Remove(Me.DataGrid1)

Me.TabControl1.SelectedTab.Controls.Add(Me.DataGrid1)

End If

End Sub

Anyway, it seems to work fine be handling
the "OnSelectedChanged" event of
 

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