1 Attachment(s)
[RESOLVED] create calendar with msflexgrid flexgrid grid control
Attachment 95493 please finish for me or help. No need for years. January, March, May, July, August, October, December have 31 days. September, April, June, November have 30 days.
Code:
Private Sub Form_Load()
Dim C As Integer
Dim R As Integer
cboMonth.AddItem "January"
cboMonth.AddItem "February"
cboMonth.AddItem "March"
cboMonth.AddItem "April"
cboMonth.AddItem "May"
cboMonth.AddItem "June"
cboMonth.AddItem "July"
cboMonth.AddItem "August"
cboMonth.AddItem "September"
cboMonth.AddItem "October"
cboMonth.AddItem "November"
cboMonth.AddItem "December"
cboDay.AddItem "Monday"
cboDay.AddItem "Tuesday"
cboDay.AddItem "Wednesday"
cboDay.AddItem "Thursday"
cboDay.AddItem "Friday"
cboDay.AddItem "Saturday"
cboDay.AddItem "Sunday"
MSFlexGrid1.Rows = 6
MSFlexGrid1.Cols = 7
MSFlexGrid1.FixedCols = 0
For C = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid1.ColWidth(C) = 600
Next C
For R = 0 To MSFlexGrid1.Rows - 1
MSFlexGrid1.RowHeight(R) = 600
Next R
With MSFlexGrid1
.Row = 0
.Col = 0
.Text = "Mon"
.Col = 1
.Text = "Tue"
.Col = 2
.Text = "Wed"
.Col = 3
.Text = "Thu"
.Col = 4
.Text = "Fri"
.Col = 5
.Text = "Sat"
.Col = 6
.Text = "Sun"
End With
End Sub
Re: create calendar with msflexgrid flexgrid grid control
What do you need help with? We can not do the whole project for you.
Re: create calendar with msflexgrid flexgrid grid control
how do i put numbers 1 to 31 across
Re: create calendar with msflexgrid flexgrid grid control
Like this
"vb" Code:
.Row = 1
.Col = 0
.Text = 1
.Row = 1
.Col = 1
.Text = 2
.Row = 1
.Col = 2
.Text = 3
Although, you need to figure out how to connect the month to how many days it has so the correct number of days for each month is displayed because not every month has 31 days
Edit:
I have done it for you.
vb Code:
Option Explicit
Dim days As Integer, i As Integer
Private Sub cmdSetup_Click()
Dim c As Integer
Dim r As Integer
With MSFlexGrid1
.Row = 1
.Col = 6
End With
Select Case cboMonth
Case "January"
days = 31
Case "February"
days = 28
Case "March"
days = 31
Case "April"
days = 30
Case "May"
days = 31
Case "June"
days = 30
Case "July"
days = 31
Case "August"
days = 31
Case "September"
days = 30
Case "October"
days = 31
Case "November"
days = 30
Case "December"
days = 31
End Select
With MSFlexGrid1
For i = 1 To days
.Text = i
If .Col = 6 Then
.Row = .Row + 1
.Col = 0
Else
.Col = .Col + 1
End If
Next i
End With
End Sub