Hi,
I'm a newbie in ASP.NET and try to run a code from www.asp.net, session
tutorials subsession
ASP.NET Web Forms topic Working With Business Objects
----
---
webform1.aspx
----
---
<%@dotnet.itags.org. Import Namespace="HelloWorld" %>
<html>
<style>
div
{
font: 8pt verdana;
background-color:cccccc;
border-color:black;
border-width:1;
border-style:solid;
padding:10,10,10,10;
}
</style>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim Comp As HelloObjVB
Comp = New HelloObjVB()
Message.InnerHtml &= Comp.SayHello() + "<p>"
Comp.FirstName = "Microsoft .NET Framework"
Message.InnerHtml &= Comp.SayHello() + "<p>"
Comp.FirstName = "ASP.NET"
Message.InnerHtml &= Comp.SayHello() + "<p>"
Comp.FirstName = "World!!!"
Message.InnerHtml &= Comp.SayHello()
End Sub
</script>
----
--
HelloObj.vb
----
--
Imports System
Imports System.Text
Namespace HelloWorld
Public Class HelloObj
Private _name As String
Public Sub New
MyBase.New()
_name = Nothing
End Sub
Public Property FirstName As String
Get
Return(_name)
End get
Set
_name = value
End Set
End Property
Public Function SayHello() As String
Dim sb As New StringBuilder("Hello ")
If (_name <> Nothing) Then
sb.Append(_name)
Else
sb.Append("World")
End If
sb.Append("!")
Return(sb.ToString())
End Function
End Class
End Namespace
----
--
When I try to run the aplication occor the fowling error.
----
--
Server Error in '/WebApplication2' Application.
----
--
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.
Compiler Error Message: BC30002: Type 'HelloObjVB' is not defined.
Source Error:
Line 9: Sub Page_Load(Sender As Object, E As EventArgs)
Line 10:
Line 11: Dim Comp As HelloObjVB
Line 12: Comp = New HelloObjVB()
Line 13:
Source File: http://localhost/WebApplication2/WebForm1.aspx Line: 11
What is happing'Hi,
Any of the following could be the culprit.
a. HelloObj.vb could be in an inaccessible directory (e.g. directory in at a
higher level than the webapplication2 virtual directory or at a different
structure altogether)
b. It hasn't been first compiled into a .dll.
c. It has been compiled but .dll was not referenced into your web project.
Good luck,
.Js
"Wilson Beirigo Duarte" <wbeirigo@.terra.com.br> wrote in message
news:c6hlet031f3@.news4.newsguy.com...
> Hi,
> I'm a newbie in ASP.NET and try to run a code from www.asp.net,
session
> tutorials subsession
> ASP.NET Web Forms topic Working With Business Objects
>
>
> ----
--
> ---
> webform1.aspx
> ----
--
> ---
> <%@. Import Namespace="HelloWorld" %>
> <html>
> <style>
> div
> {
> font: 8pt verdana;
> background-color:cccccc;
> border-color:black;
> border-width:1;
> border-style:solid;
> padding:10,10,10,10;
> }
> </style>
> <script language="VB" runat="server">
> Sub Page_Load(Sender As Object, E As EventArgs)
> Dim Comp As HelloObjVB
> Comp = New HelloObjVB()
> Message.InnerHtml &= Comp.SayHello() + "<p>"
> Comp.FirstName = "Microsoft .NET Framework"
> Message.InnerHtml &= Comp.SayHello() + "<p>"
> Comp.FirstName = "ASP.NET"
> Message.InnerHtml &= Comp.SayHello() + "<p>"
> Comp.FirstName = "World!!!"
> Message.InnerHtml &= Comp.SayHello()
> End Sub
> </script>
>
>
> ----
--
> --
> HelloObj.vb
> ----
--
> --
> Imports System
> Imports System.Text
> Namespace HelloWorld
> Public Class HelloObj
> Private _name As String
> Public Sub New
> MyBase.New()
> _name = Nothing
> End Sub
> Public Property FirstName As String
> Get
> Return(_name)
> End get
> Set
> _name = value
> End Set
> End Property
> Public Function SayHello() As String
> Dim sb As New StringBuilder("Hello ")
> If (_name <> Nothing) Then
> sb.Append(_name)
> Else
> sb.Append("World")
> End If
> sb.Append("!")
> Return(sb.ToString())
> End Function
> End Class
> End Namespace
>
> ----
--
> --
> When I try to run the aplication occor the fowling error.
> ----
--
> --
>
> Server Error in '/WebApplication2' Application.
> ----
--
> --
> Compilation Error
> Description: An error occurred during the compilation of a resource
required
> to service this request. Please review the following specific error
details
> and modify your source code appropriately.
> Compiler Error Message: BC30002: Type 'HelloObjVB' is not defined.
> Source Error:
>
> Line 9: Sub Page_Load(Sender As Object, E As EventArgs)
> Line 10:
> Line 11: Dim Comp As HelloObjVB
> Line 12: Comp = New HelloObjVB()
> Line 13:
>
> Source File: http://localhost/WebApplication2/WebForm1.aspx Line: 11
>
> What is happing'
>
>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment