Results 1 to 3 of 3

Thread: VB Assistance

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2012
    Posts
    1

    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?

  2. #2
    Addicted Member
    Join Date
    Jun 2010
    Location
    The Keystone State
    Posts
    131

    Re: VB Assistance

    Date is a keyword which contains the current date of your computer.

  3. #3
    Addicted Member vb_ftw's Avatar
    Join Date
    Dec 2010
    Posts
    139

    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:
    1. Private Sub DateTimePicker2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker2.ValueChanged
    2.         UpdateLabels(DateTimePicker2)
    3.     End Sub
    4.     Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
    5.         UpdateLabels(DateTimePicker1)
    6.     End Sub
    7.     Sub UpdateLabels(ByVal Dto As DateTimePicker)
    8.         qualtxt.Text = Dto.Value.Date
    9.         twosoontxt.Text = Dto.Value.Date.AddDays(25)
    10.         twolatetxt.Text = Dto.Value.Date.AddDays(35)
    11.  
    12.         threesoontxt.Text = Dto.Value.Date.AddDays(55)
    13.         threelatetxt.Text = Dto.Value.Date.AddDays(65)
    14.  
    15.         foursoontxt.Text = Dto.Value.Date.AddDays(85)
    16.         fourlatetxt.Text = Dto.Value.Date.AddDays(95)
    17.     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
  •  



Click Here to Expand Forum to Full Width