473,508 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem using an assembly

I have a User Control that I created (.ascx & .ascx.vb file pair) that I am trying to put in a separate assembly. I know that the User Control works when it is in the same project and is compiled along with the project it is used in, so the problem is obviously something I am doing wrong with the references or something. My current code registers the assembly as:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="DatePickerTest.aspx.vb" Inherits="WebApplication1.DatePickerTest"%>

<%@ Register TagPrefix="NateCtrl" Namespace="NateCtrl" Assembly="NateCtrl" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<title>DatePickerTest</title>

<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">

<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">

<meta content="JavaScript" name="vs_defaultClientScript">

<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">

</HEAD>

<body>

<form id="Form1" method="post" runat="server">

<NateCtrl:DatePicker id="DatePickerCtrl" runat="server"></NateCtrl:DatePicker><BR><BR>

<asp:label id="lblSelectedDate" runat="server"></asp:label>

<asp:button id="btnRefresh" runat="server" Font-Bold="True" EnableViewState="False" Text="Refresh"></asp:button><BR><BR>

<asp:button id="btnXmas2000" runat="server" Font-Bold="True" EnableViewState="False" Text="Christmas 2000" CausesValidation="False"></asp:button><BR><BR>

<asp:button id="btnMyBirthday" runat="server" Font-Bold="True" EnableViewState="False" Text="My Birthday" CausesValidation="False"></asp:button><BR><BR>

<asp:button id="btnNewYear95" runat="server" Font-Bold="True" EnableViewState="False" Text="New Year's 1995" CausesValidation="False"></asp:button>

</form>

</body>

</HTML>
When I attempt to execute the page, I recieve the following error:


Server Error in '/WebApplication1' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 62: ViewState.Add("stopyear", Date.Today.Year + 25)
Line 63: For i As Integer = 1 To 12
Line 64: ddlMonth.Items.Add(New System.Web.UI.WebControls.ListItem(System.Globaliz ation.DateTimeFormatInfo.CurrentInfo.GetMonthName( i), CStr(i)))
Line 65: Next
Line 66: Me.CreateLists()

Source File: c:\inetpub\wwwroot\NateCtrl\DatePicker.ascx.vb Line: 64

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
NateCtrl.DatePicker.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\NateCtrl\DatePicker.ascx.vb:64
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Page.ProcessRequestMain() +750

What am I missing here? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Oct 9 '05 #1
3 1356
HI
Can u see in the behind code is the ASCX declared. ASCX can work
independent of assemblies

-------
Regards ,
C#, VB.NET , SQL SERVER , UML , DESIGN Patterns Interview question book
http://www.geocities.com/dotnetinterviews/
My Interview Blog
http://spaces.msn.com/members/dotnetinterviews/

Oct 9 '05 #2
Hi,

Your @Register is wrong here is an example from one of my
projects.

<%@ Register TagPrefix="uc1" TagName="RssViewer" Src="RssViewer.ascx" %>

If drag the control from the solution explorer to the form you
want the control on. VB.net will add the @ register for you.

Ken
----------------
"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have a User Control that I created (.ascx & .ascx.vb file pair) that I am
trying to put in a separate assembly. I know that the User Control works
when it is in the same project and is compiled along with the project it is
used in, so the problem is obviously something I am doing wrong with the
references or something. My current code registers the assembly as:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="DatePickerTest.aspx.vb"
Inherits="WebApplication1.DatePickerTest"%>
<%@ Register TagPrefix="NateCtrl" Namespace="NateCtrl" Assembly="NateCtrl"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>DatePickerTest</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<NateCtrl:DatePicker id="DatePickerCtrl"
runat="server"></NateCtrl:DatePicker><BR><BR>
<asp:label id="lblSelectedDate" runat="server"></asp:label>
<asp:button id="btnRefresh" runat="server" Font-Bold="True"
EnableViewState="False" Text="Refresh"></asp:button><BR><BR>
<asp:button id="btnXmas2000" runat="server" Font-Bold="True"
EnableViewState="False" Text="Christmas 2000"
CausesValidation="False"></asp:button><BR><BR>
<asp:button id="btnMyBirthday" runat="server" Font-Bold="True"
EnableViewState="False" Text="My Birthday"
CausesValidation="False"></asp:button><BR><BR>
<asp:button id="btnNewYear95" runat="server" Font-Bold="True"
EnableViewState="False" Text="New Year's 1995"
CausesValidation="False"></asp:button>
</form>
</body>
</HTML>

When I attempt to execute the page, I recieve the following error:
Server Error in '/WebApplication1' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

Line 62: ViewState.Add("stopyear", Date.Today.Year + 25)
Line 63: For i As Integer = 1 To 12
Line 64: ddlMonth.Items.Add(New
System.Web.UI.WebControls.ListItem(System.Globaliz ation.DateTimeFormatInfo.CurrentInfo.GetMonthName( i),
CStr(i)))
Line 65: Next
Line 66: Me.CreateLists()
Source File: c:\inetpub\wwwroot\NateCtrl\DatePicker.ascx.vb Line: 64

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
NateCtrl.DatePicker.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\NateCtrl\DatePicker.ascx.vb:64
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Control.LoadRecursive() +98
System.Web.UI.Page.ProcessRequestMain() +750


What am I missing here? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Oct 9 '05 #3
On Sun, 9 Oct 2005 01:24:20 -0400, "Nathan Sokalski"
<nj********@hotmail.com> wrote:
I have a User Control that I created (.ascx & .ascx.vb file pair) that I am trying to put in a separate assembly. I know that the User Control works when it is in the same project and is compiled along with the project it is used in, so the problem is obviously something I am doing wrong with the references or something. My current code registers the assembly as:


It's not really possible to do this in 1.x, because Visual Studio
doesn't know how to compile the .ascx file into an assembly.
In 2.0 the ASP.NET runtime does all the compilation. I have a proof of
concept where I use the AspNet compiler to produce assemblies and
merge them together to reference from another project:
http://odetocode.com/Blogs/scott/arc...0/06/2326.aspx

--
Scott
http://www.OdeToCode.com/blogs/scott/
Oct 9 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
8450
by: SJD | last post by:
I've just read Christoph Schittko's article on XmlSerializer: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp . . . and very informative it is too....
3
3333
by: Dan | last post by:
Hi, I have a problem using an aspx page with a Control on it. I get the following error message Compiler Error Message: CS1595: 'Test.Class2' is defined in multiple places; using definition...
3
544
by: Hamilton | last post by:
Hi there, I've seen this error appear a few times in newsgroups but unfortunately I haven't found one that actually provides a solution. I'm basically deploying a new website into an area at a...
8
3396
by: Rob Edwards | last post by:
When trying to add the Microsoft CDO for Exchange Management Library (aka CDOEXM.dll) I receive the following message: "A reference to 'Microsoft CDO for Exchange Management Library' could not be...
1
3353
by: abh1508 | last post by:
Following a release of code the following problem occurs on certain asp ..net pages. This is not a problem on other testing/demo environments. IIS seems to be creating certain files twice in the...
13
3910
by: Lee Newson | last post by:
Hi, I have just written my first application using VB.NET. The app works fine when i am running it within .NET for debugging purposes, however when i try to run the app from the .exe file that...
3
2276
by: Doug | last post by:
I'm having problems w/ the VS2005 debugger with C#. It blows past any breakpoints in even the simplest "Hello World" console application. I can't do any step-by-step debugging. I've provided the...
1
2349
by: Tim F | last post by:
Problem: I'm receiving the error "File or assembly name XXXXX or one of its dependencies, was not found." when trying to execute code in an assmebly that has both a strong-name and has been...
5
6006
by: Harold Howe | last post by:
I am having a problem deserializing objects from a library when the following conditions exist: 1- The library is strongly named 2- The serialized file was created with version 1.0 of the...
0
1489
by: Rafa | last post by:
Hello, First, sorry because I am spanish and my english are not good. My problem is that i am trying to work with profiles in visual studio 2005, but i have an error. the error is that: ...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.