Go Premium for a chance to win a PS4. Enter to Win


Exposing UserControl's Constituent Ctrl Property

Posted on 2000-04-06
Medium Priority
Last Modified: 2013-12-25
Please help.  I am on a tight timeline (as always!!).  I really need some URGENT help.

I have created a user control(UC) with some text boxes.  In another project, I have a form (form1) with a datarepeater (drptAll) that is using the UC I made as its RepeatedControlName with a adodc (adoTP).  Now when the user enters info in the drptAll in 3 of the UC text boxes (year, month, day), I would like to update the 4th UC text box (TPVal) with a calculation based on the 1st 3 fields.  I am using the Let, Get, and Changed (PropertyChanged) procedures in my UC.

In my project, I have the datarepeater
I am a complete novice to building usercontrols etc. so you will have to explain some things.  I tried to do it from the UC but nothing happened.  Should I be doing it from my form1?  If so, where is the "Changed" property of my fields and how do I use it?  Here is my UC code:
Public Property Get Yr() As String
    Yr = txtYr.Text
End Property

Public Property Let Yr(ByVal newYear As String)
    txtYr.Text = newYear
End Property

Public Property Get Mnth() As String
    Mnth = txtMon.Text
End Property

Public Property Let Mnth(ByVal newMonth As String)
    txtMon.Text = newMonth
End Property

Public Property Get Dy() As String
    Dy = txtDay.Text
End Property

Public Property Let Dy(ByVal newDay As String)
    txtDay.Text = newDay
End Property

Public Property Get TPVal() As String
'    TPVal = txtTPVal.Text
    TPVal = (CInt(txtYr.Text) * 12) + (CInt(txtMon.Text)) + (CInt(txtDay.Text) / 31)
End Property

Public Property Let TPVal(ByVal newTPVal As String)
    txtTPVal.Text = newTPVal
End Property


Thanks in advance.
Question by:mcb123

Author Comment

ID: 2693731
Please help - I really am desperate!!!

Accepted Solution

GivenRandy earned 280 total points
ID: 2764312
It looks like you're trying to do both class based (e.g., ActiveX control/exe/dll) and "user control" at the same time.  If you are just using a user control with the text boxes you defined, try using the following code instead:


Private Sub txtMon_Change()
End Sub

Private Sub txtYr_Change()
End Sub

Private Sub txtDay_Change()
End Sub

Private Sub SetTPVal()
    txtTPVal.Text = (Val(txtYr.Text) * 12) + Val(txtMon.Text) + (Val(txtDay.Text) / 31)
End Sub


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

927 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