[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

2 questions about ComboBox

Posted on 2004-10-31
3
Medium Priority
?
200 Views
Last Modified: 2010-04-23
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
Comment
Question by:aeusta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:koolnurd
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

by:aeusta
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

by:
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
                    cboDay.Items.Add(i)
                Next
            Case 2
                For i = 1 To 28
                    cboDay.Items.Add(i)
                Next
            Case 4, 6, 9, 11
                For i = 1 To 30
                    cboDay.Items.Add(i)
                Next
            Case Else

        End Select
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
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…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question