Hai,
I am using Infragistics V10.1. I have a tab control in my report preview form. One report have more than 1 sub reports. I am generating the sub reports and placing it in a seperate tab pages in runtime.
I have to remove this tab page on click of close button in tab. And also If i have only one tabpage i have to change the tab style as Wizard. So i write the coding as below to remove the tab and to change the style in the "TabClosed" event.
Private Sub uchildtabctrl_TabClosed(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinTabControl.TabClosedEventArgs) Handles uchildtabctrl.TabClosed Try If e.Tab.TabControl.Tabs IsNot Nothing Then e.Tab.TabControl.ActiveTab = Nothing If e.Tab.TabControl.Tabs.Count = 2 Then e.Tab.TabControl.Style = UltraTabControlStyle.Wizard End If If e.Tab.TabControl IsNot Nothing Then e.Tab.TabControl.Tabs.Remove(e.Tab) End If End If Catch ex As Exception QbShowError(ex) End Try End Sub
But i got "Unhandled error" sometimes. I attached the video for your reference. I also placed the "Innerexception" text below.
System.NullReferenceException was unhandled Message="Object reference not set to an instance of an object." Source="Infragistics2.Win.UltraWinTabControl.v10.1" StackTrace: at Infragistics.Win.UltraWinTabControl.UltraTabPageControl.set_Visible(Boolean value) at Infragistics.Win.UltraWinTabControl.UltraTabControlBase.OnManagerSelectedTabItemChanged(Object sender, SelectedTabItemChangedEventArgs e) at Infragistics.Win.UltraWinTabs.TabManager.set_SelectedTabItem(ITabItem value) at Infragistics.Win.UltraWinTabs.TabManager.AutoSelectTab(ITabItem tab) at Infragistics.Win.UltraWinTabs.TabItemUIElement.OnTimerTick(Object sender, EventArgs e) at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at InstantUI.My.MyApplication.Main(String[] Args) at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:
Note : I got error only when i set the tab control's "Autoselect" as true. If i set it as false, this error didnt come (please refer the inner exception above). I have no coding for the tab control other than this "TabClosed".
I changed the "Autoselect" as false for my tab control. Now the problem not coming. If anyone have the solution to this problem, inform me.