?
Solved

User Controls and referencing them

Posted on 2006-07-18
2
Medium Priority
?
170 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 2000 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

770 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