Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Calendar

1 view
Skip to first unread message

Jay Horvitz

unread,
Nov 30, 2001, 5:30:20 PM11/30/01
to
I am writing a program that uses a calendar but I am not sure how to
populate it. I have 2 text boxes that will show the month and year, and I
have 35 smaller text boxes that will show the date, Is there a way that I
can populate these without having to do a separate form for each month?

Thank you

--
Jay Horvitz
jay...@home.com


Terry Austin

unread,
Nov 30, 2001, 7:03:04 PM11/30/01
to

"Jay Horvitz" <jay...@home.com> wrote in message
news:0MTN7.198987$My2.11...@news1.mntp1.il.home.com...

> I am writing a program that uses a calendar but I am not sure how to
> populate it. I have 2 text boxes that will show the month and year, and I
> have 35 smaller text boxes

You'll need six rows, not five.

>that will show the date, Is there a way that I
> can populate these without having to do a separate form for each month?

Is there a reason you're not using one of the calendar controls?

Terry Austin


Rick Rothstein

unread,
Dec 1, 2001, 10:08:50 AM12/1/01
to
The algorithm is quite easy as long as you use a control array. For this example, I am
using Labels and not TextBoxes for the calendar days (why would you allow your user to be
able to edit the day's number?). Put 42 Label controls in a control array, indexed from 0
to 41, and lay them out in order in a grid that is 7 Labels across by 6 Labels high. This
code (note the month is taken as an integer, 1 to 12) will fill in the Labels with the
appropriate numbers:

Rick

Dim StartBox As Integer
Dim LastDay As Integer
Dim TheYear As Integer
Dim TheMonth As Integer
' Calculate the Index number for the
' Label that will receive Day #1
StartBox = Weekday(DateSerial(TheYear, _
TheMonth, 1)) - 1
' Calculate the last day of the month
LastDay = Day(DateSerial(TheYear, _
TheMonth + 1, 0))
' Clear existing Labels that might not
' be overwritten with a new day number
For x = 0 To 6
Label1(x).Caption = ""
Label1(x + 28).Caption = ""
Label1(x + 35).Caption = ""
Next
' Fill in the days of the month
For x = StartBox To StartBox + LastDay - 1
Label1(x).Caption = x - StartBox + 1
Next

"Jay Horvitz" <jay...@home.com> wrote in message
news:0MTN7.198987$My2.11...@news1.mntp1.il.home.com...

______________________________________________________________________________
Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net

J French

unread,
Dec 1, 2001, 3:57:28 PM12/1/01
to
On Fri, 30 Nov 2001 16:03:04 -0800, "Terry Austin"
<tau...@hyperbooks.com> wrote:

<snip>


>Is there a reason you're not using one of the calendar controls?
>
>Terry Austin
>

I've heard of many problems with the calendar control
>

WYLTK

unread,
Dec 2, 2001, 8:22:18 PM12/2/01
to

"Rick Rothstein" <rick_ne...@email.com> wrote in message
news:3c08e...@corp-goliath.newsgroups.com...

Why wouldn't you just use the built in calendar object?

>
>
> "Jay Horvitz" <jay...@home.com> wrote in message
> news:0MTN7.198987$My2.11...@news1.mntp1.il.home.com...
> > I am writing a program that uses a calendar but I am not sure how to
> > populate it. I have 2 text boxes that will show the month and year, and
I
> > have 35 smaller text boxes that will show the date, Is there a way that
I
> > can populate these without having to do a separate form for each month?
> >
> > Thank you
> >
> > --
> > Jay Horvitz
> > jay...@home.com
> >
> >
>
>
____________________________________________________________________________
__
> Posted Via Binaries.net = SPEED+RETENTION+COMPLETION =
http://www.binaries.net


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----

Rick Rothstein

unread,
Dec 2, 2001, 9:06:04 PM12/2/01
to
> Why wouldn't you just use the built in calendar object?

Your question was asked earlier by Terry Austin and responded to by J French. I decided to
show an algorithm that worked in case Jay wanted to continue to do it himself. Besides, my
way allows for customizations of functionality that a "canned" control may not offer.

Rick

______________________________________________________________________________

J French

unread,
Dec 3, 2001, 9:59:08 AM12/3/01
to
On Sun, 2 Dec 2001 21:06:04 -0500, "Rick Rothstein"
<rick_ne...@email.com> wrote:

>> Why wouldn't you just use the built in calendar object?

Because it is (reportedly) buggy - also it is another dreaded OCX -
also because Rick Rothstein has shown how to avoid such problems.

I count 3 reasons.

Terry Austin

unread,
Dec 3, 2001, 11:47:26 AM12/3/01
to

"J French" <je...@iss.u-net.com> wrote in message
news:3c0b71d9...@news.u-net.com...

> On Sun, 2 Dec 2001 21:06:04 -0500, "Rick Rothstein"
> <rick_ne...@email.com> wrote:
>
> >> Why wouldn't you just use the built in calendar object?
>
> Because it is (reportedly) buggy - also it is another dreaded OCX -
> also because Rick Rothstein has shown how to avoid such problems.
>
> I count 3 reasons.

Each of which, alone, is sufficient. I was merely curious.

Terry Austin


Terry Austin

unread,
Dec 3, 2001, 11:46:37 AM12/3/01
to

"J French" <je...@iss.u-net.com> wrote in message
news:3c089fd1...@news.u-net.com...

That would be an excellent reason. It certainly gives you fits
with the P&D wizard until you edit the dependency file.
Haven't had any trouble with it since then, though.

Terry Austin


0 new messages