|
-
Dec 15th, 2009, 09:36 AM
#1
Thread Starter
Addicted Member
[RESOLVED] MonthCalendar problem
I have one more problem with MonthControl.
I have For...Next hanger.
And when I bold some dates the program doesn't show bold dates on month calendar.
When I move on next or previous month and get back to currently month the program normal displays bold dates. What's the problem?
-
Dec 15th, 2009, 11:36 AM
#2
Fanatic Member
Re: MonthCalendar problem
You're not being very descriptive.
Some code that generates the bold dates might help a bit.
Visual Studio 2010 Professional | .NET Framework 4.0 | Windows 7
SERYSOFT.COM :: SysPad - Folder Management Program - Please comment HERE if you find this program useful, have ideas, or know of any bugs.
[Very useful for IT/DP departments where many folders are consistently accessed. Also contains a scratchpad window for quick access to notes.]
[.NET and MySQL Quick Guide]
-
Dec 15th, 2009, 11:51 AM
#3
Re: MonthCalendar problem
What is "For...Next hanger"?
As for the bolded dates problem, you need to call UpdateBoldedDates method after you add bolded date(s) to your MonthCalendar
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Dec 15th, 2009, 03:45 PM
#4
Thread Starter
Addicted Member
Re: MonthCalendar problem
For...Next
Dim a As Integer
Dim b As Integer
For a = 1 To b
...
Next
-
Dec 15th, 2009, 05:14 PM
#5
Re: MonthCalendar problem
 Originally Posted by hepeci
For...Next
Dim a As Integer
Dim b As Integer
For a = 1 To b
...
Next
So what is the problem with this loop? Your a and b variables are not initialized thus they get the default value of zero.
In the For loop, you set a = 1, but b is still 0, so the loop never runs any iteration. If you want to loop backwards, you have to explicitly code it
Code:
For a = 1 to b Step -1
....
Next
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
-
Dec 15th, 2009, 05:19 PM
#6
Re: MonthCalendar problem
Based on what I am reading, when you add bolded dates, the control is not refreshing until you move months, is that correct?
If so, did you try calling UpdateBoldedDates?
-
Dec 16th, 2009, 10:46 AM
#7
Thread Starter
Addicted Member
Re: MonthCalendar problem
Negative,thanks! 
And one more thing, how to check is some date bold?
-
Dec 16th, 2009, 11:00 AM
#8
Re: MonthCalendar problem
BoldedDates is an array of bolded dates. You could use the Contains method to determine if a specific date is bolded or not.
-
Dec 16th, 2009, 02:13 PM
#9
Thread Starter
Addicted Member
Re: MonthCalendar problem
Actually I'm interested in how to check is selected date bold or not.
-
Dec 16th, 2009, 02:17 PM
#10
Re: MonthCalendar problem
So check to see if the BoldedDates contains the SelectionStart date.
-
Dec 16th, 2009, 02:17 PM
#11
Fanatic Member
Re: MonthCalendar problem
Just how Negative0 told you.
Visual Studio 2010 Professional | .NET Framework 4.0 | Windows 7
SERYSOFT.COM :: SysPad - Folder Management Program - Please comment HERE if you find this program useful, have ideas, or know of any bugs.
[Very useful for IT/DP departments where many folders are consistently accessed. Also contains a scratchpad window for quick access to notes.]
[.NET and MySQL Quick Guide]
-
Dec 16th, 2009, 02:23 PM
#12
Thread Starter
Addicted Member
Re: MonthCalendar problem
Code:
lblDate.Text = MonthCalendar1.SelectionRange.Start
That's code for printing selected dates, this goes on _DateChanged event of MonthCalendar control, and how to check bold dates, actually is selected date bold or not?
-
Dec 16th, 2009, 02:33 PM
#13
Re: MonthCalendar problem
I think this is what they have told you
Code:
Private Sub MonthCalendar1_DateChanged(ByVal sender As Object, _
ByVal e As System.Windows.Forms.DateRangeEventArgs) _
Handles MonthCalendar1.DateChanged
If MonthCalendar1.BoldedDates.Contains(MonthCalendar1.SelectionStart) Then
Stop
End If
End Sub
-
Dec 16th, 2009, 02:42 PM
#14
Thread Starter
Addicted Member
Re: MonthCalendar problem
This code doesn't work ('Contains' is not a member of 'System.Array')
-
Dec 16th, 2009, 02:43 PM
#15
Re: MonthCalendar problem
What version of the .Net Framework are you using?
-
Dec 16th, 2009, 02:45 PM
#16
Thread Starter
Addicted Member
Re: MonthCalendar problem
-
Dec 16th, 2009, 02:47 PM
#17
Fanatic Member
Re: MonthCalendar problem
Actually, your code will have to be something like this:
Code:
Dim boldDateList() As Date = MonthCalendar1.BoldedDates
For Each d As Date In boldDateList
If d.ToShortDateString = MonthCalendar1.SelectionStart.ToShortDateString Then
MessageBox.Show("True")
End If
Next
I realized that BoldedDates returns the selected Date *with* the current time appended to the end. Therefore, trying to compare SelectionStart with a BoldedDate item won't work. The dates may match but the times won't. So, you have to be able to shorten the date to just the date, which is done above.
Maybe there is a way to do it with BoldedDates, but I can't find one.
Visual Studio 2010 Professional | .NET Framework 4.0 | Windows 7
SERYSOFT.COM :: SysPad - Folder Management Program - Please comment HERE if you find this program useful, have ideas, or know of any bugs.
[Very useful for IT/DP departments where many folders are consistently accessed. Also contains a scratchpad window for quick access to notes.]
[.NET and MySQL Quick Guide]
-
Dec 16th, 2009, 02:55 PM
#18
Thread Starter
Addicted Member
Re: MonthCalendar problem
-
Dec 16th, 2009, 03:04 PM
#19
Re: [RESOLVED] MonthCalendar problem
That means that you did something like this
Code:
MonthCalendar1.AddBoldedDate(#12/19/2009 08:00#)
instead of
Code:
MonthCalendar1.AddBoldedDate(#12/19/2009#)
-
Dec 16th, 2009, 03:07 PM
#20
Fanatic Member
Re: [RESOLVED] MonthCalendar problem
 Originally Posted by dbasnett
That means that you did something like this
Code:
MonthCalendar1.AddBoldedDate(#12/19/2009 08:00#)
instead of
Code:
MonthCalendar1.AddBoldedDate(#12/19/2009#)
Well, true, I guess it depends on how you add the dates.
I was doing it like this:
Code:
MonthCalendar1.AddBoldedDate(Now.AddDay(-4))
MonthCalendar1.AddBoldedDate(Now())
MonthCalendar1.AddBoldedDate(Now.AddDay(3))
Visual Studio 2010 Professional | .NET Framework 4.0 | Windows 7
SERYSOFT.COM :: SysPad - Folder Management Program - Please comment HERE if you find this program useful, have ideas, or know of any bugs.
[Very useful for IT/DP departments where many folders are consistently accessed. Also contains a scratchpad window for quick access to notes.]
[.NET and MySQL Quick Guide]
-
Dec 16th, 2009, 03:11 PM
#21
Re: [RESOLVED] MonthCalendar problem
If you would have added them like this you wouldn't have needed the additional code.
Code:
MonthCalendar1.AddBoldedDate(Now.AddDays(-4).Date)
MonthCalendar1.AddBoldedDate(Now().Date)
MonthCalendar1.AddBoldedDate(Now.AddDays(3).Date)
If MonthCalendar1.BoldedDates.Contains(MonthCalendar1.SelectionStart.Date) Then
Beep()
End If
So we worked around the OP's problem, but did we actually fix it?
Last edited by dbasnett; Dec 16th, 2009 at 03:16 PM.
-
Dec 16th, 2009, 03:19 PM
#22
Fanatic Member
Re: [RESOLVED] MonthCalendar problem
I guess it depends on how he is adding his dates and where he is getting them from. lol
Visual Studio 2010 Professional | .NET Framework 4.0 | Windows 7
SERYSOFT.COM :: SysPad - Folder Management Program - Please comment HERE if you find this program useful, have ideas, or know of any bugs.
[Very useful for IT/DP departments where many folders are consistently accessed. Also contains a scratchpad window for quick access to notes.]
[.NET and MySQL Quick Guide]
-
Dec 16th, 2009, 03:19 PM
#23
Re: [RESOLVED] MonthCalendar problem
The OP never posted code for how the dates were being bolded. Well hopefully it is not one of those things that one wrong led to a kludge, that will lead to many more problems.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|