Hi!

I have a question I couldn't find answer to.
I have a datepicker where user can pick a date. This is a warranty start date.
Then there is a warranty duration combobox with options: 1 year, 2 years; 3 years.
And then there is a textbox that should display warranty end date.

So the logic should be like this: get the datepicker date then get the number of years from combobox and then calculate: datepicker date + combobox years = Textbox with end date.

For example: Datepicker date(10.10.2012) + combobox years(2 years) = Textbox (10.10.2014)

Any idea how to do this?

Private Sub DateTimePicker1_ValueChanged(sender As System.Object, e As System.EventArgs) Handles DateTimePicker1.ValueChanged

    If ComboBox1.SelectedIndex >= 0 Then
        Dim dt As DateTimePicker = sender
        MsgBox(dt.Value)
        MsgBox(DateAdd(DateInterval.Year, CInt(ComboBox1.Text), dt.Value))
    End If

End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.