|
 |
aspx thread: Convert this vb code to C#
Message #1 by "Wouzer Wilco" <inhumanoid@y...> on Fri, 23 Nov 2001 18:59:39
|
|
Howdy,
Can somebody convert this code to C# ? :
<script language="VB" runat="server">
Dim Holidays(12,31) as string
Sub Page_Load ( s as object, e as eventargs)
Holidays(1,1) = "<br<font size=-1>New Year<font>"
Holidays(7,4) = "<br><font size=-1>Independence Day<font >"
End Sub
Sub DayRender( s as object, e as DayRenderEventArgs)
e.Cell.Controls.Add(New LiteralControl(Holidays(e.Day.Date.Month, _
e.Day.Date.Day)))
End Sub
</script>
Message #2 by Tim Heuer <TimH@i...> on Sat, 24 Nov 2001 08:56:51 -0700
|
|
Try this (i haven't yet)
<script language="C#" runat="server">
string[] Holidays = new string[12,31];
void Page_Load(object sender, EventArgs e)
{
Holidays[1,1] = "<br<font size=-1>New Year<font>";
Holidays[7,4] = "<br><font size=-1>Independence Day<font >";
}
</script>
your dayrender function should be almost exactly the same with the exception
of the input args (object sender, DayRenderEventArgs e) and the elimination
of "Sub" to void.
One thing you may want to test out is if the indexing is correct. VB allows
for a 1-based index, but c# is normally a 0-based one...so your array first
holiday may be Holidays[0,0] instead...
-----Original Message-----
From: Wouzer Wilco [mailto:inhumanoid@y...]
Sent: Friday, November 23, 2001 12:00 PM
To: ASP+
Subject: [aspx] Convert this vb code to C#
Howdy,
Can somebody convert this code to C# ? :
<script language="VB" runat="server">
Dim Holidays(12,31) as string
Sub Page_Load ( s as object, e as eventargs)
Holidays(1,1) = "<br<font size=-1>New Year<font>"
Holidays(7,4) = "<br><font size=-1>Independence Day<font >"
End Sub
Sub DayRender( s as object, e as DayRenderEventArgs)
e.Cell.Controls.Add(New LiteralControl(Holidays(e.Day.Date.Month, _
e.Day.Date.Day)))
End Sub
</script>
---
VBug Winter Conference 2001
Open Forum: Dan Appleman will be hosting an open
forum at The .NET Developer's Conference on
29th November 2001. The session will give
developers the chance to discuss and question
Dan on his experience with the .NET environment.
Dan has been programming Visual Basic since the
alpha version 1.0. And with over 10 years
Visual Basic experience is well qualified to
help you on your road to being a .NET Guru.
http://www.vbug.co.uk/redirect.asp?url=39&id=17
---
You are currently subscribed to
aspx as: timh@i...
$subst('Email.Unsub')
|
|
 |