I need to add an ultrawingrid control to an UltraWintab control at runtime. Apparently I am adding it to a wrong part of the tab control because the grid control fails to get created (Created property is false when I look at it in debugger) without giving me any errors.If I use the same construct to add grid to the form itself, it works perfectly fine so I figure the fault is with the WinTab. I found a related article for webtab (Knowledge Base Article: KB0979) and tried to apply it to wintab, but the object structure is a bit different, and I stiil can not make my code work. Below is the code I am using. I will appreciate any help.
Dim ctr As New Infragistics.Win.UltraWinGrid.UltraGrid ctr.Name = GridNameTry MainTab.Tabs(PanelKey).TabPage.Controls.Add(ctr) Return ctrCatch ex As Exception Return NothingEnd Try
Thanks for the help! Something was probably wrong with my Visual studio. Everything worked fine after I rebooted.
Hello Helen,
I am just checking about the progress of the issue. Did you solve your issue accordingly the information that I provided to you?
Let me know if you need any further assistance.
Thank you for using Infragistics Components.
Sincerely,
Hristo
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
At the following link you could see how to create controls in run time:
http://www.vbexplorer.com/VBExplorer/vb_feature/april2000/april2000.asp
I have modified your code a little in order to achieve what you are looking for:
Dim ctr As New Infragistics.Win.UltraWinGrid.UltraGrid
ctr.Name = "GridName"
ctr.Text = "GridName"
ctr.Location = New Point(2, 2)
ctr.Visible = True
Try
UltraTabControl1.Tabs(0).TabPage.Controls.Add(ctr)
Return
Catch ex As Exception
End Try
When you create a control at runtime in VB, by default, the Visible property of the new control is set to False, and is necessary to set location of the control to tell the compiler where to display the control in parent container. It’s good idea to set up all property of a control before add it in container.
Please let us know if you have any further questions.