Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Why this code don't work?

Reply
Thread Tools

Why this code don't work?

 
 
Wilson Beirigo Duarte
Guest
Posts: n/a
 
      04-26-2004
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????




 
Reply With Quote
 
 
 
 
John Smith
Guest
Posts: n/a
 
      04-26-2004
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" <> wrote in message
news:...
> 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????
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Cisco 2611 and Cisco 1721 : Why , why , why ????? sam@nospam.org Cisco 10 05-01-2005 08:49 AM
Why, why, why??? =?Utf-8?B?VGltOjouLg==?= ASP .Net 6 01-27-2005 03:35 PM
Why Why Why You HAVE NO IDEA MCSE 31 04-24-2004 06:40 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57