Hi,
I have a form with tab control in it and in on of the tabs I got a datagrid.
On runtime, whenever I try to display data on the datagrid from a
database, the datagrid "jumps" from the tab to the form itself so the
tab hides most of it.
What am I doing wrong?
Thanks,
Udi
Datagridview on Tab control
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

CrishRank #1,487 · 1.1K reputationPosted Dec 12, 2010, 11:36 PM EST
This code shows how to use data gridview in tabcontrol.
private void MyTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { Dispatcher.BeginInvoke((Action)delegate(TabItem selectedTab) { if (selectedTab == MyTab) { MyColumn.Width = new DataGridLength(1, DataGridLengthUnitType.Star); } } , System.Windows.Threading.DispatcherPriority.ApplicationIdle, MyTabControl.SelectedItem); If you want to learn and get more detail about this code just go through this below link. http://social.msdn.microsoft.com/Forums/en/wpf/thread/8cc4fc1f-1d30-4424-9207-e058374fd6a7 }Udi Goldstein19 reputationPosted Dec 13, 2010, 10:21 AM EST
I've figured out what I did wrong, it now works (I've initialized the datagrid on form1 when I should've initialized it to the controltab)
Thanks,
Udi