Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Populate a combo box with Years
Hi everyone, I'm designing an application which requires me to have a combo
box drop down list that has in it a list of previous 100 years, from 1900 to
2000. Now although I could just manually type them in, I would like the
application to automatically update itself as the years go by. Is there a
solution to this issue? If so, how. Please advise.

I'd greatly appreciate.

Thanks in advance

Report this thread to moderator Post Follow-up to this message
Old Post
Ricky
03-09-05 09:01 AM


Re: Populate a combo box with Years
> Hi everyone, I'm designing an application which requires me to have a
combo
> box drop down list that has in it a list of previous 100 years, from
1900 to
> 2000. Now although I could just manually type them in, I would like
the
> application to automatically update itself as the years go by. Is
there a
> solution to this issue? If so, how. Please advise.

If you want the ComboBox to have the 100 years from 1900 to 2000 (which
is actually 101 years by the way) and the current year is 2005, what do
you mean by "I would like the application to automatically update itself
as the years go by"? What was different about the last 5 years that you
didn't want an automatic update to take place?

As for putting the years 1900 to 2000 into a ComboBox (assumed to be
named Combo1)

Dim X As Long
Combo1.Clear
For X = 1900 To 2000
Combo1.AddItem CStr(X)
Next

Rick - MVP


Report this thread to moderator Post Follow-up to this message
Old Post
Rick Rothstein
03-09-05 09:01 AM


Re: Populate a combo box with Years
Rick Rothstein wrote: 
>
> If you want the ComboBox to have the 100 years from 1900 to 2000
> (which is actually 101 years by the way) and the current year is
> 2005, what do you mean by "I would like the application to
> automatically update itself as the years go by"? What was different
> about the last 5 years that you didn't want an automatic update to
> take place?

Perhaps what he means is that as each year goes by, one year is dropped off
and the next added.

In which case, change the following line: -

> As for putting the years 1900 to 2000 into a ComboBox (assumed to be
> named Combo1)
>
> Dim X As Long
> Combo1.Clear

For X = Year(Now)-100 to Year(Now)

>   Combo1.AddItem CStr(X)
> Next
>
> Rick - MVP

--
Regards,

Michael Cole



Report this thread to moderator Post Follow-up to this message
Old Post
Michael Cole
03-09-05 09:01 AM


Re: Populate a combo box with Years
Great, thanks a lot guys. I'm sorry for the little confusion. What Michael
assumed is exactly what I meant. When the customer information is filled in,
clerk will choose from a list of "Years", the year of birth. And as the year
s
go by, 1 year is dropped. I decided to keep 100 years in there, just in case
.
=)

Thanks again....

"Michael Cole" wrote:

> Rick Rothstein wrote: 
>
> Perhaps what he means is that as each year goes by, one year is dropped of
f
> and the next added.
>
> In which case, change the following line: -
> 
>
> For X = Year(Now)-100 to Year(Now)
> 
>
> --
> Regards,
>
> Michael Cole
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Ricky
03-09-05 09:01 AM


Re: Populate a combo box with Years
Can't see the point.
If the combobox list is from 1900 to 2000 (or 1906-2005 in 2005), then by th
e time you move the cursor to 1947 (when I
was born) and select it, it would be quicker to have typed "1947" into a tex
t box!!
Even if you make it a drop-down box, you'd still be typing it in
(Even quicker - "47" and add a bit of code to pick up the century - after al
l, you're limiting it to 100 years)
And what if you DID have someone older than 100 years?
(Yeah, I know, ...... sigh .......... have another combobox)
Ummmm.... Just attracting arrows - don't take me too seriously :->
Argusy

Ricky wrote:
> Great, thanks a lot guys. I'm sorry for the little confusion. What Michael
> assumed is exactly what I meant. When the customer information is filled i
n,
> clerk will choose from a list of "Years", the year of birth. And as the ye
ars
> go by, 1 year is dropped. I decided to keep 100 years in there, just in ca
se.
> =)
>
> Thanks again....
>
> "Michael Cole" wrote:
>
> 
>


Report this thread to moderator Post Follow-up to this message
Old Post
argusy
03-09-05 09:02 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic Syntax archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:02 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.