Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling a SUB from a Class from a namespace VB.Net
    primarykey
    data
    text
    <p>I have a code but cant get it to work. I have a .vb site with a namespace and a Class and a Sub. Then on my index.aspx site i cant to call this sub The 2 sites is in the root of my project, and the name of the project is CalendarWeek</p> <p>My WeekController.vb is</p> <pre><code>Imports System Imports System.Web.UI.WebControls.Calendar Imports System.Globalization Namespace CalendarWeekController Public Class WeekShow Shared Sub Main() ' Gets the Calendar instance associated with a CultureInfo. Dim myCI As New CultureInfo("da-DK") Dim myCal As Calendar = myCI.Calendar ' Gets the DTFI properties required by GetWeekOfYear. Dim myCWR As CalendarWeekRule = myCI.DateTimeFormat.CalendarWeekRule Dim myFirstDOW As DayOfWeek = myCI.DateTimeFormat.FirstDayOfWeek ' Displays the number of the current week relative to the beginning of the year. Console.WriteLine("The CalendarWeekRule used for the en-US culture is {0}.", myCWR) Console.WriteLine("The FirstDayOfWeek used for the en-US culture is {0}.", myFirstDOW) Console.WriteLine("Therefore, the current week is Week {0} of the current year.", myCal.GetWeekOfYear(DateTime.Now, myCWR, myFirstDOW)) ' Displays the total number of weeks in the current year. Dim LastDay = New System.DateTime(DateTime.Now.Year, 12, 31) Console.WriteLine("There are {0} weeks in the current year ({1}).", myCal.GetWeekOfYear(LastDay, myCWR, myFirstDOW), LastDay.Year) End Sub 'Main End Class </code></pre> <p>End Namespace</p> <p>And My index.aspx is</p> <pre><code> &lt;%@ Import Namespace="CalendarWeekController" %&gt; &lt;%@ Page Language="vb" AutoEventWireup="false" CodeBehind="index.aspx.vb" Inherits="" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;% Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Me.IsPostBack = False Then Call WeekShow(Sub Main) End If End Sub %&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>i get this error when running the site. Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. </p> <p>Parser Error Message: Could not load type 'CalendarWeek.CalendarWeekController'.</p> <p>Source Error: </p> <p>Line 1: &lt;%@ Import Namespace="CalendarWeekController" %> Line 2: &lt;%@ Page Language="vb" AutoEventWireup="false" Inherits="CalendarWeek.CalendarWeekController" %> Line 3: Line 4: </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload