hi friends

i m using datetimepicker for date, i want whenever the month in date is 3,4 etc. then combobox should add the month in words ie. march,april etc. automitically.

for eg.
if todays date is 16-1-2011 then combobox should add item jan only or

if already added 12th month in collection of combobox then it should show jan only remaining should disable.

it 16-2-2011 then feb and so on

i m not getting how to start coding for this
how to compare month and add item to combobox

Recommended Answers

All 2 Replies

use : DateTimePicker1_ValueChanged event

A little demonstration

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

        Dim strmonth As String = String.Empty

        If Me.DateTimePicker1.Value.Month = 1 Then
            strmonth = "Jan"
        End If

        If Me.DateTimePicker1.Value.Month = 2 Then
            strmonth = "Feb"
        End If

        If Me.DateTimePicker1.Value.Month = 3 Then
            strmonth = "March"
        End If

        If Me.DateTimePicker1.Value.Month = 4 Then
            strmonth = "April"
        End If

        If Me.DateTimePicker1.Value.Month = 5 Then
            strmonth = "May"
        End If
        If Me.DateTimePicker1.Value.Month = 6 Then
            strmonth = "June"
        End If
        If Me.DateTimePicker1.Value.Month = 7 Then
            strmonth = "July"
        End If
        If Me.DateTimePicker1.Value.Month = 8 Then
            strmonth = "August"
        End If


        If Me.DateTimePicker1.Value.Month = 9 Then
            strmonth = "September"
        End If

        If Me.DateTimePicker1.Value.Month = 10 Then
            strmonth = "October"
        End If

        If Me.DateTimePicker1.Value.Month = 11 Then
            strmonth = "November"
        End If

        If Me.DateTimePicker1.Value.Month = 12 Then
            strmonth = "December"
        End If


        If Me.ComboBox1.Items.Contains(strmonth) Then

        Else
            Me.ComboBox1.Items.Add(strmonth)
        End If

    End Sub

thanks......................

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.