On 8 Jun 1997 07:36:59 GMT, "Susan Barker" <11@wed.wed> wrote:
>I need assistance in designing a calendar program. I am only
>a beginning VB. programmer, and did not fully understand what to do.Please
>help. if you have
any ideas please let me know.
>the user must put the name of the month in textbox, number of days of the
>month (31,30 or ..) in the next textbox, year (199x ) in another textbox,
>first day in another textbox ( Monday=1), then you get all these printed on
The user doesn't have
to give all this input.. just the date.
make a new project with a form and a command button
Put the next code under the click event of the command button..
press f5 to run
BTW: perhaps you have
to make
a change with the date-separator and the order (european = dd-mm-yy / american = mm-dd-yy). And of course to the output; it's now just straight forward!
Private sub
Command1_Click()
dim
StartDatum
dim
vMonth
dim
vYear
dim
StartDag
dim
vRow%, vColomn%
Const t1% = 5
Const t2% = 10
Const t3% = 15
Const t4% = 20
Const t5% = 25
Const t6% = 30
dim
c%
dim
GoFurther%
startdatum
= InputBox("which first date", , Format(Now, "dd-mm-yy"))
If startdatum
= "" Then Exit Sub
vMonth = Month(StartDatum)
vYear = Year(StartDatum)
startdatum
= CDate("1-" & vMonth & "-" & vYear)
StartDag = DatePart("w", StartDatum)
'1=sunday
'2=monday
'etc
GoFurther% = False
Printer.Print StartDatum
Printer.Print "S"; Tab(t1); "M"; Tab(t2); "T"; Tab(t3); "W"; _
Tab(t4); "T"; Tab(t5); "F"; Tab(t6); "S"
Screen.MousePointer = vbHourglass
For vRow% = 1 To 6
For vColomn% = 1 To 7
If (StartDag = vColomn% And Not GoFurther%) Then
c% = 1
Printer.Print Str(c%);
GoFurther% = True
Else
If (GoFurther% And IsDate(CStr(c%) & "-" & vMonth & _
"-" & vYear)) Then Printer.Print Str(c%);
end
If
select
case
vColomn%
case
1
Printer.Print Tab(t1);
case
2
Printer.Print Tab(t2);
case
3
Printer.Print Tab(t3);
case
4
Printer.Print Tab(t4);
case
5
Printer.Print Tab(t5);
case
6
Printer.Print Tab(t6);
end
Select
c% = c% + 1
Next vColomn%
Printer.Print
Next vRow%
Printer.EndDoc
Screen.MousePointer = vbNormal
End Sub
Return