By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,887 Members | 1,154 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,887 IT Pros & Developers. It's quick & easy.

viable solution?

P: n/a
Instead of impementing icomparer for a custom calendar class to find a
button
with a particular date property value I have done the following:
'on a form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim b As calBut = Me.Calendar1.CallButton(#10/8/2004#)
Console.WriteLine(b.Date)
End Sub
'the calendar control
Public Class Calendar
Inherits System.Windows.Forms.UserControl
'......

Public Event CallingButton(ByVal d As Date)
Public calledbutton As calBut
Function CallButton(ByVal d As Date) As calBut
calledbutton = Nothing
RaiseEvent CallingButton(d)
Return calledbutton
End Function

End Class

'calendar button class
Public Class calBut
Inherits Button

'......

Friend Sub OnCallingButton(ByVal d As Date)

If d = Me.Date Then
Dim parent As Calendar = DirectCast(Me.Parent, Calendar)
parent.calledbutton = Me
End If
End Sub

End Class
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
what's the actual question?
"Nathan Carroll" wrote:
Instead of impementing icomparer for a custom calendar class to find a
button
with a particular date property value I have done the following:
'on a form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim b As calBut = Me.Calendar1.CallButton(#10/8/2004#)
Console.WriteLine(b.Date)
End Sub
'the calendar control
Public Class Calendar
Inherits System.Windows.Forms.UserControl
'......

Public Event CallingButton(ByVal d As Date)
Public calledbutton As calBut
Function CallButton(ByVal d As Date) As calBut
calledbutton = Nothing
RaiseEvent CallingButton(d)
Return calledbutton
End Function

End Class

'calendar button class
Public Class calBut
Inherits Button

'......

Friend Sub OnCallingButton(ByVal d As Date)

If d = Me.Date Then
Dim parent As Calendar = DirectCast(Me.Parent, Calendar)
parent.calledbutton = Me
End If
End Sub

End Class

Nov 21 '05 #2

P: n/a
Viable solution?
"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
what's the actual question?
"Nathan Carroll" wrote:
Instead of impementing icomparer for a custom calendar class to find a
button
with a particular date property value I have done the following:
'on a form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim b As calBut = Me.Calendar1.CallButton(#10/8/2004#)
Console.WriteLine(b.Date)
End Sub
'the calendar control
Public Class Calendar
Inherits System.Windows.Forms.UserControl
'......

Public Event CallingButton(ByVal d As Date)
Public calledbutton As calBut
Function CallButton(ByVal d As Date) As calBut
calledbutton = Nothing
RaiseEvent CallingButton(d)
Return calledbutton
End Function

End Class

'calendar button class
Public Class calBut
Inherits Button

'......

Friend Sub OnCallingButton(ByVal d As Date)

If d = Me.Date Then
Dim parent As Calendar = DirectCast(Me.Parent, Calendar)
parent.calledbutton = Me
End If
End Sub

End Class

Nov 21 '05 #3

P: n/a
Does it work???

Then yes... it's a viable solution.
"Nathan Carroll" <th************@Bhutan.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Viable solution?
"Bonj" <Bo**@discussions.microsoft.com> wrote in message
news:8F**********************************@microsof t.com...
what's the actual question?
"Nathan Carroll" wrote:
Instead of impementing icomparer for a custom calendar class to find a
button
with a particular date property value I have done the following:
'on a form
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim b As calBut = Me.Calendar1.CallButton(#10/8/2004#)
Console.WriteLine(b.Date)
End Sub
'the calendar control
Public Class Calendar
Inherits System.Windows.Forms.UserControl
'......

Public Event CallingButton(ByVal d As Date)
Public calledbutton As calBut
Function CallButton(ByVal d As Date) As calBut
calledbutton = Nothing
RaiseEvent CallingButton(d)
Return calledbutton
End Function

End Class

'calendar button class
Public Class calBut
Inherits Button

'......

Friend Sub OnCallingButton(ByVal d As Date)

If d = Me.Date Then
Dim parent As Calendar = DirectCast(Me.Parent, Calendar)
parent.calledbutton = Me
End If
End Sub

End Class


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.