How do I Iterate through the controls in a MultiView View

Posted on 2007-10-05
Last Modified: 2013-11-26
Hello Experts,

How do I Iterate through the controls in a MultiView View.  All the controls are user controls in an html table.

Question by:katzhoward
    1 Comment
    LVL 27

    Accepted Solution

    Hi Howard,
    I do not do alot of web, but here is some sample code that I use to move thru alot of controls at once.
    'Place in page loading area
    'Place in vb side area
      Private Sub KeyPress_Tabs(ByVal container As Control)
            For Each c As Control In container.Controls
                If c.HasChildren Then
                    KeyPress_Tabs(c) ' recurse into another container
                    Select Case TypeName(c)
                        Case "CheckBox"
                            AddHandler CType(c, CheckBox).KeyPress, AddressOf Controls_KeyPress
                        Case "ComboBox"
                            AddHandler CType(c, ComboBox).KeyPress, AddressOf Controls_KeyPress
                        Case "TextBox"
                            AddHandler CType(c, TextBox).KeyPress, AddressOf Controls_KeyPress
                    End Select
                End If
        End Sub
        Private Sub Controls_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
            If e.KeyChar = Chr(13) Then
                e.Handled = True
            End If
        End Sub

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now