-
Mar 2nd, 2012, 12:37 PM
#1
Thread Starter
New Member
VB Assistance
Newby to VB here, having a problem developing my first application.
I have a VB form and I've used a DateTimePicker to populate dates to my lables. The dates are based on 30, 60, and 90 day intervals (+/- 5 days).
Code:
Private Sub DateTimePicker2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker2.ValueChanged
Qualtxt.Text = DateTimePicker2.Value.Date
twosoontxt.Text = DateTimePicker2.Value.Date.AddDays(25)
twolatetxt.Text = DateTimePicker2.Value.Date.AddDays(35)
threesoontxt.Text = DateTimePicker2.Value.Date.AddDays(55)
threelatetxt.Text = DateTimePicker2.Value.Date.AddDays(65)
foursoontxt.Text = DateTimePicker2.Value.Date.AddDays(85)
fourlatetxt.Text = DateTimePicker2.Value.Date.AddDays(95)
These dates are ranges that evaluations are supposed to be conducted. In the event that the eval didn't happen within those dates, I also have another lable where the user can input the dates. I changed the label's "text.changed" property to clear all following evals, but I need the rest of the eval schedules to follow that actual date. Since the format is derived from the datetimepicker's value, I don't know how to make the remaining labels reflect the new intervals based on the actual date.
Can anyone please help?
-
Mar 4th, 2012, 01:06 PM
#2
Addicted Member
Re: VB Assistance
Date is a keyword which contains the current date of your computer.
-
Mar 4th, 2012, 03:12 PM
#3
Addicted Member
Re: VB Assistance
why complicate things...allow the user to choose a date from another datetimepickercontrol and create a sub and send it the datetimepicker
see the example:
vb Code:
Private Sub DateTimePicker2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker2.ValueChanged UpdateLabels(DateTimePicker2) End Sub Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged UpdateLabels(DateTimePicker1) End Sub Sub UpdateLabels(ByVal Dto As DateTimePicker) qualtxt.Text = Dto.Value.Date twosoontxt.Text = Dto.Value.Date.AddDays(25) twolatetxt.Text = Dto.Value.Date.AddDays(35) threesoontxt.Text = Dto.Value.Date.AddDays(55) threelatetxt.Text = Dto.Value.Date.AddDays(65) foursoontxt.Text = Dto.Value.Date.AddDays(85) fourlatetxt.Text = Dto.Value.Date.AddDays(95) End Sub
in this example datetimepicker1 is for the user. though, i don't see why the user just can't use the original control u created
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|