Solved

User Controls and referencing them

Posted on 2006-07-18
2
169 Views
Last Modified: 2010-04-23
Hi there, I have a user control called Rate.  Rate is many text boxes, and I have a public function within rate called get_Rate which returns an integer relating to the values in all the text boxes.  i.e. if i know the rate_ID i know the values of all the boxes in the Rate control.

On any given form many instances of the control can be created programatically.

I am at a point in my code where i need to cycle through all the controls on a page, the user control and text boxes, combos etc.

    'Standard structure for recording an entry
    Public Structure TrackData
        Dim Ref As Integer
        Dim Data As String
    End Structure

    Public Sub Capture(ByRef pArray As ArrayList, ByRef pPanel As Panel)
        'Put all data into an array as a benchmark for checking against later.
        pArray.Clear() 'delete everything from current array
        Dim td As New TrackData
        Dim ctrl As Control
        For Each ctrl In pPanel.Controls
            If TypeOf ctrl Is TextBox Or TypeOf ctrl Is ComboBox Then
                td.Ref = ctrl.Handle
                td.Data = ctrl.Text
                pArray.Add(td)
            End If
            If TypeOf ctrl Is Rate Then
                td.Ref = ctrl.Handle
                td.Data = ctrl.get_Rate()
            End If
        Next
    End Sub

The piece of code errors on ctrl.get_Rate.  This is a public function however!

How do i get around this??

Many thanks, 500 points on offer!
0
Comment
Question by:DavidGreenfield
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 500 total points
ID: 17128551
Hi DavidGreenfield,

td.Data = Ctype(ctrl,Rate).get_Rate()

Perhaps

Tim Cottee
0
 

Author Comment

by:DavidGreenfield
ID: 17128635
Yes that works!  I hadn't realised you could do that for a user control!

Many thanks, 500 points on the way!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 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