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
255
Getting controls from panel/tile
posted

http://help.infragistics.com/Help/Doc/WinForms/2012.1/CLR2.0/html/WinTilePanel_Adding_Multiple_Controls_to_a_Tile_in_WinTilePanel.html

Following the above example, we add a new tile

Dim utp1 As Infragistics.Win.Misc.UltraTilePanel     '//THE ULTRA-TILEPANEL PANEL

Dim tile1 As New Infragistics.Win.Misc.UltraTile()  '//THE ULTRA-TILE

Dim upTilesPanel As New UltraPanel                   '//THE ULTRA-PANEL 

utp1.Tiles.Add(tile1)                                       '//ADD TILE TO TILEPANEL

tile1.Control = upTilesPanel                              '//ADD PANEL TO TILE

then we add contols:

a textbox(s):

  Dim txt1 As New TextBox

txt1.name = "TXT1NAME"

txt1.Width = upTilesPanel.ClientArea.Width - 23
txt1.Anchor = AnchorStyles.Left Or AnchorStyles.Right
upTilesPanel.ClientArea.Controls.Add(txt1)                        '//ADD TEXTBOX TO PANEL

A datetimepicker..

 Dim dat1 As New DateTimePicker

dat1.name = "DAT1NAME"

dat1.Width = upTilesPanel.ClientArea.Width - 23
dat1.Anchor = AnchorStyles.Left Or AnchorStyles.Right
upTilesPanel.ClientArea.Controls.Add(dat1)

a button

Dim btn1 as new button

btn1.Width = upTilesPanel.ClientArea.Width - 23

btn1.Font = New Font("", 10, FontStyle.Bold)
upTilesPanel.ClientArea.Controls.Add(btn1)
AddHandler btn1.Click, AddressOf TileButtonClicked

..and so on

The problem, when the button is clicked, we want to get the txt in the textbox, and the value of the datetimepicker

For example sakes, lets just use MSGBOX()


Private Sub TileButtonClicked(sender As Object, e As EventArgs)

  MSGBOX (upt1.tiles(0).controls(0).ClientArea.Controls("DAT1NAME").text  ) '??ERR: 

MSGBOX (upt1.tiles(0).controls(0).ClientArea.Controls("TXT1NAME").text  ) '??ERR: 

  MSGBOX(   ????    )  '//HOW TO PRINT CONTROL (0).TEXT & CONTROL(1).VALUE

End Sub



  • 255
    Verified Answer
    posted

    Ive solved this by making the panel global.

       The panel cannot be disposed or it will give errors if you reuse the panel

    Dim upTilesPanel As New UltraPanel  

    It can be called as so

    Dim tempdtp As DateTimePicker = upTilesPanel.ClientArea.Controls("DAT1NAME")

    'from.Controls.ClientArea.Controls()
    MSGBOX( tempdtp.Value.tostring )
    ''GET SECOND DATETIME
    tempdtp = upTilesPanel.ClientArea.Controls("DAT2NAME")
    MSGBOX ( tempdtp.Value.tostring)

    Dim temptxt As TextBox = upTilesPanel.ClientArea.Controls("TXT1NAME")

    MSGBOX( temptxt.text )

  • 21795
    Offline posted

    Hello Stan,

    I am just checking about the progress of this issue. Let me know if you need my further assistance on it.

    Thank you for using Infragistics Components.

  • 21795
    Verified Answer
    Offline posted

    Hello Stan,

    Thank you for contacting Infragistics Developers Support.

    The issue you are facing is a result of the object you are getting by this statement:

    upt1.Tiles(0).Control

    When you call this you are getting the UltraTilePanel’s (upt1) first UltraTile’s (tile1) control as Windows.Forms.Control. In your case the actual type of this control is UltraPanel and  you need cast it to the actual type in order  to reach its ClientArea property. You may use code like this:

    Dim MyPanel As UltraPanel = DirectCast(Me.upt1.Tiles(0).Control, Infragistics.Win.Misc.UltraPanel)

    Then you can get the controls you need like this:

    MsgBox(MyPanel.ClientArea.Controls("DAT1NAME").Text)

    MsgBox(MyPanel.ClientArea.Controls("TXT1NAME").Text)

    Please find attached a small sample project implementing this approach.

    Please let me know if you need any further assistance.

    CAS-149053-N4P3W1.zip