Displaying entire year in C# WinForm application - c#

Is it possible to display the entire year (not month by month) in MonthCalendar control. If not is there another option or do I have to make my own control. I need to graphically display some events that happen on certain dates or in certain intervals, and I need to display them for entire year so the standard MonthCalendar's display is not applicable in this case.

Yes you can display a maximum of 12 months. Sincerly I've not worked a lot with this control but looking in the msdn in MonthCalendar Members I found the MonthCalendar.SetCalendarDimensions Method that:
Sets the number of columns and rows of months to display.
So you need to do this:
myMonthCalendarControl.SetCalendarDimensions(4, 3);
//I used 4 columns and 3 rows because the product should be not greater than 12

Related

How to make a report in crystal report that its columns' number may changes anytime

I am working on a report in crystal-report which its columns are the days of month
and as you know the number of the days changes every month.
So my question is how to change the number of columns from 30 to 29
for example automatically
can you help by sending video tutorial about this?
One option is to insert a CrossTab and set the column to be the day of the month.
The CrossTab would adapt the number of columns to the data automatically.
But the question is not clear. I'm just guessing that would be a useful option.

C# selected calendar days into datagridview columns

I'm creating this function for my attendance monitoring system, now I want to have a datagridview (or if you can suggest some other way) that will show the school days based on the calendar (with out sat. and sun.)
Similar to this, the highlighted part:
As columns and it will change depending on the filter that I select in my combobox.
e.g. I selected January and only the school days of January will be the header.
I just have these 2 questions:
1. How can I make the selected days (of month selected in combobox) to headers of column.
2. what will be my datasource? should I create a database for it?
Help me out, I can't quite get the logic needed here.

How Can I Make table with different number of rows - C#.net

I need any hints to help me how to apply this idea, first of all I want to do table contain a column is about week's days, it will be bind from database, maybe all days of the week or some days.
Each day has maybe one or two rows, according to the user needs, and each row has 4 columns it is fixed number, it will not change.
For example, I enter to my account, I found from Saturday to Monday in my table, each Day has one row as default, this row has 4 columns. If I want to fill Saturday I have two periods not one period, so I have to have plus button if I click on it there is a new row will be add to fill the second period, and if I save my work these two rows will related to Saturday as I added.
I hope you Understand what I want, I use C# , ASP.NET & SQL Server.

C# Datetimepicker : Set forecolor to Specific Date

I am using a datetimepicker in my application. I want it to display specific dates (in this case, all Holidays of a month) with one specific color (i.e. The holidays will be shown as red or blue or any color) when the datetimepicker is clicked and its monthview (i don't know exact name of this) is prompted. Is it possible with default datetimepicker ?
Suppose there are holidays in August are all the public holidays (in this case, every fri and sat) and some specific holidays (such as 13 Aug,19 Aug etc) and I want to show them in red/blue color. This will also occur when I change the month to September (or any month).
I shall bring the holidays from database where I keep my holiday records.
Thanks in advanced.
A longer time ago i had to do similar solution for a busines Application.
you might wanna look at http://msdn.microsoft.com/en-us/magazine/dd882520.aspx
i don't think i can sum it up better than this site.
Look at "Figure 8 The RedLetterDays Display". Sounds like the thing you need.
greetings

Generate dynamic calendar controls

How to generate dynamic controls based on selecton by user?
I had appeared for one practical test recently where they had the below mentioned requirements
They had 2 calendars (asp.net default).
They had two options (radio button list) : One was "Repeat On" and another "Repeated On"
The Repeat on had 2 drop down :
1) Day Dropdown: It values were: Every, Every Other Day, Every Third Day
2) Duration dropdown: It values were: Day, Month, Week, Year
The Repeated on had 2 drop down :
1) Week: the values were First Week, Second Week, Third Week
2) Day: Sunday, Monday .... Saturday
Now when i click the first calendar's date as say August 10 2010 and second one as January 26 2011, then i wanted that dynamic calendars should be generated that would show the Calendars from August to January (inclusive of both)
For Filter purpose, if i select First Sunday (From REPEATED ON Option) then first sunday of dynamic calendars should be selected. If i select every third day then every 3rd day should be selected (in dynamic generated calendars)
What i did was : Could generate dynamic calendars by creating object of calendar class.. is that right? Plus i searched on google and they show that DayRender Event could be a possible solution but that didn't help...
How to do that? How to generate dynamic calendar?
Please let me know if question is not being understood.
Pass me on code similar to that the least
thanks!
Sounds like what you want to do is set the properties Calendar.SelectedDate and Calendar.VisibleDate.
I'm not sure exactly what you're going for since I don't know what type of control the user will be selecting your Jan 1/Jun 1 dates from, or what the 3rd sunday has to do with that. Is there only one calendar? Please explain a little more if the info below doesn't help you.
I'll paste some VB code from one of my apps, hopefully it will help you out.
Protected Sub calArrival_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles calArrival.SelectionChanged
SetFormDepartureEntry()
lblArrivalDate.Text = calArrival.SelectedDate.ToLongDateString
calDeparture.SelectedDate = calArrival.SelectedDate
calDeparture.VisibleDate = calArrival.SelectedDate
dtSelectedArrival = "1/1/2000"
'Determine if we need to see 2 months to view all possible departure dates.
If (DatePart(DateInterval.Month, calDeparture.SelectedDate) <> _
DatePart(DateInterval.Month, DateAdd(DateInterval.Day, 14, calDeparture.SelectedDate))) Then
calDeparture2.Visible = True
calDeparture2.SelectedDate = Nothing
calDeparture2.VisibleDate = DateAdd(DateInterval.Month, 1, calDeparture.SelectedDate)
Else
calDeparture2.Visible = False
End If
End Sub
OK now that you have posted the details this becomes a different question. You don't know how many calendars you need to so you will probably want to create them in code. I would suggest using a Panel control in your markup to contain all the possible result calendars. Then as you suggested earlier, create new Calendar objects as needed and add them to the "anchor" Panel's Controls collection.
Calendar objCal = new Calendar();
pnlResultsContainer.Controls.Add(objCal);
As far as setting selected days, you can only have one "selected" day per calendar I believe. However you can set the rendering styles, and whether the day is enabled, etc., by handling the Calendar.DayRender event. Maybe someone can help me out on setting up a handler for dynamically created controls in C#? I think it's something like:
objCal.DayRender += AddressOf(DynamicDayRenderHandler());
Please correct if this is not right.
Determining the correct day to set styles on in the handler will be a matter of coding against the DayRenderEventArgs.Day object which is a parameter of the event. I don't know offhand how to find the specific days/intervals you are looking for but it should be possible with a little research in the following articles:
How to: Customize Individual Days in a Calendar Web Server Control
DayRenderEventArgs.Day Property
Hope this helps.

Categories