Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
695
Need to add a control to a UltraWinTabControl at runtime
posted

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 = GridName
Try
    MainTab.Tabs(PanelKey).TabPage.Controls.Add(ctr)
    Return ctr
Catch ex As Exception
    Return Nothing
End Try

 

 

  • 48586
    Verified Answer
    posted

    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

  • 48586
    posted

    Hello Helen,

    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

                        Return

                    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.