Not accessible ERROR!

G

Guest

Can someone please tell me why I'm getting the following error! I have
absolutely no idea why this error keeps appearing!

Thanks for any help!



Compiler Error Message: BC30390: 'cpncms_v1.evtCalendar.Private Sub
Calendar1_DayRender(sender As Object, e As
System.Web.UI.WebControls.DayRenderEventArgs)' is not accessible in this
context because it is 'Private'.

Source Error:

Line 56: <td class="pgContent">
Line 57: <!-- Start Calender -->
Line 58: <asp:calendar id="Calendar1" OnDayRender="Calendar1_DayRender"
OnSelectionChanged="Calendar1_SelectionChanged" 'error
Line 59:OnVisibleMonthChanged="MonthChanged" DayStyle-Height="100"
DayStyle-Width="75" DayStyle-HorizontalAlign="Left"
Line 60:DayStyle-verticalalign="Top" DayStyle-Font-Name="Arial"
DayStyle-Font-Size="12" NextPrevFormat="FullMonth"



...:: CODE
Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As
DayRenderEventArgs)
Dim Item As MyDates '//Temporary storage for looping through the
collection
Dim TextColor As String

Dim DayHold As DateTime = "01/01/1900" '//Temporary date to check
for multiple items per day

Dim MultipleItemDay As Boolean = False

'// Set to true if the date is in the collection and needs to be
displayed
Dim DayTextHasChanged As Boolean = False

'//To build the string for the contents of the table cell
'//I'll use the stingbuilder class instead of concatenation
Dim temp As StringBuilder

If IsNothing(MyCollection) = True Then
Get_DBItems()
End If

For Each Item In MyCollection
'//The collection is loaded in date order. So, if the date is
different than the DayHold variable
'//And I've already found the right day in the collection, I can
exit the for loop
If DayHold <> Item._Date Then
If DayTextHasChanged = True Then
Exit For
End If
MultipleItemDay = False
DayHold = Item._Date
Else
MultipleItemDay = True
End If

'//If I've found a date matching the current date...I need to
create the appropriate text
If e.Day.Date = Item._Date.ToString("d") Then
Select Case Item._Type
Case 1 : TextColor = "Blue"
Case 2 : TextColor = "Red"
Case 3 : TextColor = "Orange"
Case 4 : TextColor = "Green"
Case 5 : TextColor = "Brown"
Case 6 : TextColor = "Gray"
Case 7 : TextColor = "#408080"
Case Else : TextColor = "Black"
End Select
If MultipleItemDay = False Then
temp = New StringBuilder '//Create a new stringbuilder
object
Else
temp.Append("<br>") '//add a seperator to the
stringbuilder
End If
temp.Append("<span style=""font-family:Arial;
font-weight:bold;font-size:12px; color:")
temp.Append(TextColor)
temp.Append("""><br>")
temp.Append(Item._Title.ToString())
temp.Append("</span>")
DayTextHasChanged = True '//Set the flag
End If
Next

'//If there was an Item for this day, add the stringbuilder text to
the table cell
If DayTextHasChanged = True Then
e.Cell.Controls.Add(New LiteralControl(temp.ToString()))
End If

End Sub
 
K

Ken Cox [Microsoft MVP]

What happens if you change Private to Public?

Tim::.. said:
Can someone please tell me why I'm getting the following error! I have
absolutely no idea why this error keeps appearing!

Thanks for any help!



Compiler Error Message: BC30390: 'cpncms_v1.evtCalendar.Private Sub
Calendar1_DayRender(sender As Object, e As
System.Web.UI.WebControls.DayRenderEventArgs)' is not accessible in this
context because it is 'Private'.

Source Error:

Line 56: <td class="pgContent">
Line 57: <!-- Start Calender -->
Line 58: <asp:calendar id="Calendar1" OnDayRender="Calendar1_DayRender"
OnSelectionChanged="Calendar1_SelectionChanged" 'error
Line 59:OnVisibleMonthChanged="MonthChanged" DayStyle-Height="100"
DayStyle-Width="75" DayStyle-HorizontalAlign="Left"
Line 60:DayStyle-verticalalign="Top" DayStyle-Font-Name="Arial"
DayStyle-Font-Size="12" NextPrevFormat="FullMonth"



..:: CODE
Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As
DayRenderEventArgs)
Dim Item As MyDates '//Temporary storage for looping through the
collection
Dim TextColor As String

Dim DayHold As DateTime = "01/01/1900" '//Temporary date to check
for multiple items per day

Dim MultipleItemDay As Boolean = False

'// Set to true if the date is in the collection and needs to be
displayed
Dim DayTextHasChanged As Boolean = False

'//To build the string for the contents of the table cell
'//I'll use the stingbuilder class instead of concatenation
Dim temp As StringBuilder

If IsNothing(MyCollection) = True Then
Get_DBItems()
End If

For Each Item In MyCollection
'//The collection is loaded in date order. So, if the date is
different than the DayHold variable
'//And I've already found the right day in the collection, I
can
exit the for loop
If DayHold <> Item._Date Then
If DayTextHasChanged = True Then
Exit For
End If
MultipleItemDay = False
DayHold = Item._Date
Else
MultipleItemDay = True
End If

'//If I've found a date matching the current date...I need to
create the appropriate text
If e.Day.Date = Item._Date.ToString("d") Then
Select Case Item._Type
Case 1 : TextColor = "Blue"
Case 2 : TextColor = "Red"
Case 3 : TextColor = "Orange"
Case 4 : TextColor = "Green"
Case 5 : TextColor = "Brown"
Case 6 : TextColor = "Gray"
Case 7 : TextColor = "#408080"
Case Else : TextColor = "Black"
End Select
If MultipleItemDay = False Then
temp = New StringBuilder '//Create a new
stringbuilder
object
Else
temp.Append("<br>") '//add a seperator to the
stringbuilder
End If
temp.Append("<span style=""font-family:Arial;
font-weight:bold;font-size:12px; color:")
temp.Append(TextColor)
temp.Append("""><br>")
temp.Append(Item._Title.ToString())
temp.Append("</span>")
DayTextHasChanged = True '//Set the flag
End If
Next

'//If there was an Item for this day, add the stringbuilder text to
the table cell
If DayTextHasChanged = True Then
e.Cell.Controls.Add(New LiteralControl(temp.ToString()))
End If

End Sub
 
K

Kevin Spencer

I din't slog through all the code you posted, but I can tell you this: That
error occurs when a private member of a class is referenced outside the
class. Private members are not accessible by other classes, nor by inherited
classes.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
S

spalding

Try redeclaring the Calendar1_DayRender procedure as

Public

eg.

Private Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As
DayRenderEventArgs)

should read

Public Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As
DayRenderEventArgs


-
spaldin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top