16,001,934 members
See more:
Hi guys , i have 2 variables here, the day which is the number of day in a month, and the number of day per week, (sunday = 1, monday = 2 and so on), lets say for example i have 30 days to display and i will display it to buttons in order , is there any possible way to display it this way?

example

day = 30
number = 2 (' which is monday)

i want to display it like this

```NULL 1  2  3   4   5   6
7 8  9  10  11  12  13
14 15 16 17  18  19  20```

and so on,

containers of the day here are buttons,

sorry for the noob question :)
Posted
Updated 9-Dec-13 21:08pm
v2
CPallini 10-Dec-13 3:08am
In your example, you have `number = 2`, however, your 'calendar-like-buttons' start from `1`. I don't get the reason why.
Goenitz 10-Dec-13 3:39am
1 there is the start of the date, 2 resembles the 2nd day of the week which is monday thats why the first column is null because it is sunday, so the calendar days will start on monday :)

## Solution 1

You can, and it's not difficult - just set the Text property of each button in turn.
But...why not just fix the text and just move the buttons?
Set up 31 buttons, (and to be honest I'd do that dynamically anyway, because I'm lazy) and store them in an array.
Then, find the DOW for the first of the month, and offset it by the width of the buttons to locate the initial X coordinate. Loop through each button: Set the X and Y location, then add the button width to the X. If you just did the last day of the week, set X to zero, and increase Y by the button height.
Repeat.

Done!

Goenitz 10-Dec-13 3:43am
Thank you Mr OriginalGriff, can you give me the actual code so that i could test it?
OriginalGriff 10-Dec-13 4:49am
Oh come on!
It's two simple lines of set up code, a loop, and the body of the loop is a couple of lines, and a condition!
What part of this is difficult for you?
Dave Kreskowiak 10-Dec-13 11:29am
Man, you're starting to sound like me! ;)
OriginalGriff 10-Dec-13 11:33am
I'll take that as a complement! :laugh:
Goenitz 10-Dec-13 20:27pm
Im sorry Mr OriginalGriff but can you explain it more detailed?
im a newbie and i cant understand T_T