Welcome to Dream.In.Code
Become a VB Expert!

Join 150,015 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,462 people online right now. Registration is fast and FREE... Join Now!




testing a custom control

 
Reply to this topicStart new topic

testing a custom control

lab3tech
14 Nov, 2006 - 12:32 PM
Post #1

New D.I.C Head
*

Joined: 28 Oct, 2006
Posts: 46


My Contributions
I need to do the following:
build a custom control with two datetimepickers and two labels. I need to use get or get/set to add test to the labels and to get the number of days between the two selected dates. I then need to test the control by using the first datetimepicker as a pickup date for a rental car and the second date as the return date. The total days is then used to calcuate the rental rate, at $50 per day. I have made the control and added it to the library so it is on the toolbox and have added this control to my test program. The code I have written for the control is as follows:
ReadOnly Property totdays() As Double
Get
totdays = DateDiff(DateInterval.Day, Date1, Date2)
Return totdays
End Get
End Property

ReadOnly Property startdate() As String
Get
startdate = "Start Date:"
Return startdate
Lbl1.Text = startdate
End Get
End Property

ReadOnly Property enddate() As String
Get
enddate = "End Date:"
Return enddate
Lbl2.Text = enddate
End Get
End Property
End Class

The code for the test program is as follows:
Private Sub BtnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCalc.Click
Dim totdays As Integer
lblCharge.Text = totdays

End Sub

I cannot get the text to display in the labels and get a return of 0 for the total charge because the totday value is 0.

Any guidance will be greatly appreciated.


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 09:03PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month