Exposing UserControl's Constituent Ctrl Property

Posted on 2000-04-06
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 70 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

808 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