Solved

Posted on 2004-10-31
Medium Priority
201 Views
Hi,
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
cboMonth.Items.Remove(29)
cboMonth.Items.Remove(30)
endIf

Thanks
0
Question by:aeusta
• 2

LVL 2

Expert Comment

ID: 12461280
A>>>

At KeyPress Check for

e.KeyChar.GetHashCode  it is 851981 for Enter.

B>>>

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 .

0

Author Comment

ID: 12461350
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.
Thanks
0

LVL 2

Accepted Solution

koolnurd earned 600 total points
ID: 12461418
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
Next
Case 2
For i = 1 To 28
Next
Case 4, 6, 9, 11
For i = 1 To 30
Next
Case Else

End Select
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
###### Suggested Courses
Course of the Month6 days, 16 hours left to enroll