2 questions about ComboBox

Let's say that I have two comboboxes named cboDay and cboMonth.

1) Let's say i want to type something into my combobox and when i click enter, i want that text that i typed to be automatically added to the list. So the next time i drop down my combobox, i want that text to be in the list.
I already set dropDownStyle to DropDown. If i have to type a code for that, could you please tell me in what procedure to write it?
cboDay_KeyPress? cboDay_Enter?

2)cboMonth has months of the year from 1 to 12. CboDays initially has numbers from 1 to 31. But not all the months has same number of days.
How will i make it so that if user clicks 2 from cboMonth, days in cboDay will remove 30 and 31 from the list? (February may have 29 days but not 30 and 31.) And when user clicks 3 from cboMonth , 30 and 31 will be added to cboDays list.
Is it gonna be something like,
 if cboMonth.selectedIndex = 1 then

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


At KeyPress Check for

e.KeyChar.GetHashCode  it is 851981 for Enter.


You Add the days at run time only first check the month and then add item in the combo through a loop.

create three conditions for 28 , 30, 31  Also 29 if consider leep year .

aeustaAuthor Commented:
Part A works, but can you be more spesific on part b?
What is the procedure to create those conditions? It would be nice if you could write the exact code.
try like this way

Dim i As Integer
        Select Case (cboMonth.Text)
            Case 1, 3, 5, 7, 8, 10, 12
                For i = 1 To 31
            Case 2
                For i = 1 To 28
            Case 4, 6, 9, 11
                For i = 1 To 30
            Case Else

        End Select

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.