I am populating a panel as a month view calendar.
Within the panel I have panels 7 across X 6 down to form a "grid" of 42 panels.
Each panel has a Label that will represent the Date.
The labels are named, top left "lblP1" to bottom right "lblP42"
In order to start the first day of the month at the correct position, I am using the following code:
Is there a more efficient way of doing this?
Possible with a For.....Next Loop using:
Image from above code:
Within the panel I have panels 7 across X 6 down to form a "grid" of 42 panels.
Each panel has a Label that will represent the Date.
The labels are named, top left "lblP1" to bottom right "lblP42"
In order to start the first day of the month at the correct position, I am using the following code:
B4X:
If FirstDayName = "Saturday" Then
lblP7.Text = "1"
lblP8.Text = "2"
lblP9.Text = "3"
lblP10.Text = "4"
lblP11.Text = "5"
lblP12.Text = "6"
lblP13.Text = "7"
lblP14.Text = "8"
lblP15.Text = "9"
lblP16.Text = "10"
lblP17.Text = "11"
lblP18.Text = "12"
lblP19.Text = "13"
lblP20.Text = "14"
lblP21.Text = "15"
lblP22.Text = "16"
lblP23.Text = "17"
lblP24.Text = "18"
lblP25.Text = "19"
lblP26.Text = "20"
lblP27.Text = "21"
lblP28.Text = "22"
lblP29.Text = "23"
lblP30.Text = "24"
lblP31.Text = "25"
lblP32.Text = "26"
lblP33.Text = "27"
lblP34.Text = "28"
lblP35.Text = "29"
lblP36.Text = "30"
End If
Possible with a For.....Next Loop using:
B4X:
DateUtils.NumberOfDaysInMonth(MyMonth, MyYear)
Image from above code: