vb.net instantiate a class

Hi, How do I  instantiate a class that I have created in my WAP (Web Application Project)?


Here is my class: 

Imports System
Imports System.Collections

Public Class TestClass

    Public Sub New()
    End Sub

    Public Function test() as String
         return "Hello World"
    End Function

End Class

Here is how I am instantiating it:


<WebMethod()> _
    Public Function test(ByVal str As String) As String
        Dim tc As TestClass
        tc = New TestClass
        Return ""
    End Function

  I get this error:

Error    2    Type 'TestClass' is not defined.   

 The class is in a folder I named "code".


If I was helpful, please mark "answered" so I can get credit. Thanks!
4/30/2009 12:10:42 PM
asp.net.web-dev-2008-express 1205 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 7
Get it on Google Play
Get it on Apple App Store

Your class should be in the App_Code, not Code.

App_Code is a special folder where all the code files get compiled the first time the application starts.

Hope this helps

If this post is useful to you, please mark it as answer.
4/30/2009 1:11:56 PM

Hi Hubble,

Thank you for your help. However, you post is incorrect. See this post http://forums.asp.net/t/1105790.aspx. 

In a WAP application any folder can be used for code. Right click on the class>properties and change the build to compile

Thanks again for the help.



If I was helpful, please mark "answered" so I can get credit. Thanks!
5/1/2009 10:28:13 AM

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Converting Web Site from Vb.Net 2003 to Vb.Net 2005
I have a web site in vb.net 2003 that I what to convert to vb.net 2005. I open my web site in the visual studio 2005 by Local IIS option. I follow the steps of the visual studio conversion wizard.In the conversion report I received the following warning 'Referencepath' settings have not been converted.  Can anyone tell what I have to do to make this warning disappear? Best regards,Sérgio 'Referencepath'  is a property you can set with with VS2003 project file, sothat when ever you to do Add reference this path is serached for class libraries.  We do not  have that ...

All, This is probably a much harder question than what should go in the "Getting Started" forum, but I am new and don't know where to put it. Anyways, I am currently developing an FTP class in VB.NET. It's kid tested, mother approved when trying to access an FTP Server on a Windows box meaning I can connect, run commands, upload and download a file no problem. My issues come when I try to use the same class with the same commands to access an FTP server on a UNIX box. I can connect and login just fine, but after that all my commands come back "500 'PWD': command not understood.". This is fo...

Both C# ASPX pages and VB.NET ASPX in single VB.NET Web Applcation Template
Hi.. Is it possible to have both c# pages and VB pages in same Webapplication, what i chose is VB.NET Web application Template. With Thanks, Jaya.... I don't see why you couldn't, but for the sake of consistency I don't know why you would want to do this. When you choose a C# or VB.NET application template(I'm assuming you're using VS or WebMatrix), it simply creates a .aspx file that includes a page directive that specifies the page language. If you created a C# template but want to use VB.Net instead, you need to go from: <%@ Page Language="C#" .... to...

Upgrading vb.net 2003 to vb.net 2008 the name '__o' is not declared
Hi I had an application in vb.net 2003. I chose to upgrade it to vb.net 2008. Now I have 153 errors telling me that the name '__o' is not declared. In one page where I get this error, It's on a <tr> statement. I searched in google and I saw that we could put <%=""%> at the beginning of the page, but I still have the error message. Any idea? Hi myriam_giroux,I think you need to be more specific information. When you are receiving errors during compilation in Visual Studio or Visual Web Developer, the Error list window will indicate the line in the sour...

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

converting to vb.net from c#.net authorize.net
authorize.net offered me some sample code when I signed up with them the only problem is the sample code is in c#.net but my page that they type all of their credit card into is vb.net <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage("https://certification.authorize.net/gateway/transact.dll"); } private String readHtmlPage(string url) { ...

VB 2008 and VB.net
Are these one and the same? Looking to grab a book on VB to use in conjunction with ASP.net. Hi mxfrail, Welcome! ok, VB exits long time ago, the las version of visual basic was 5.0 (events oriented). The appears .NET Framework 1.0 that brings C# .NET v1.0 and VB.NET 7.0 (object oriented). In 2005 Microsoft releases VS2005 (C#.NET 2.0 and VB.NET 8.0). Now this year we have C#.NET 3.0 and VB.NET 9.0. Ressuming VB.NET = VB XXXX year. hahaha Hope this informative. i don't know any book about VB because i don't use this programming language (I love C#). You can take a look around he...

how to convert vb.net website to csharp.net web site
Can we convert a website(VB.NET) to csharp.net website in VS2005???mahmood Why do you want to convert VB into C#? you can create new modules for the site in C#, and they can co-exist in the same system. If you have some specific requirements, then use online tools to convert vb.net into c# to convert the codebehind files. Most probably the .aspx file will remain unchanged, but you might need to make some changes here and there.You will get lots of converters online by just googling it. I would strongly recommend avoiding converting codes, as I have faced the horrors of the process. Programmers are tools for converting caffeine into codeVisit my blog if u mean an automatic way (with a software) i don't think it is possible and even if there is ones they won't do it the only way is to understand what each line of code trying to do and redo it with C# if this post unswerd ur question marke it as answer AhmadRock51:Can we convert a website(VB.NET) to csharp.net website in VS2005???Best way is to know the concepts and the Logic of the Application thats written in VB.NET and Re-Create it using C# .... Regards,Vinz"Code, Beer and Music" that's my way of being a programmer!How to get your Forum Question Answered | Blog | CodeASP.NET Hi, If you want to convert VB.NET to C# for reading codes better, you can use http://www.codechanger.com/ to convert. For the integrated project, it needn't to convert to the same language. C# and VB...

vb.net vs c#.net vs j#.net
just out of curiousity which looks, acts most like java? i'm still learning trying to used to vb.net but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

how ro use EAServer webservice in dw.net dev in vb.net?
i use pb10 dev a webservice but use dw.net have any problem such as sybase.datawind.blob, fullstate,changes and so on.how to deserialize Since PB10 is in beta, you need to post such questions in the private beta newsgroup. On 3 Jun 2004 07:21:01 -0700, "ma.frank" <ma.frank@163.com> wrote: >i use pb10 dev a webservice but use dw.net have any problem such as >sybase.datawind.blob, fullstate,changes and so on.how to deserialize > Bruce Armstrong [TeamSybase] http://www.teamsybase.com Two new books on developing with PowerBuilder http://www.pb9books...

vb.net Class Library
I have created a Class Library in vb.net (2.0), the library has a web reference to a web service. The problem is that when I add a reference to the class library in a different vb.net app, in the “Object Browser” I can see the namespace for the web service that is in the library. Is it possible to hide the name space for the web service so that it can not be viewed out side of the library? Thank you...

ODP.NET with Visual Web Dev Express?
Hi, Does the odp.net for oracle work with Visual Web Dev Express or do you need VS 2005 full version?  I get the following error in VWD when i add the reference to the Oracle.Data Assembly files.   Could not load file or assembly 'Oracle.DataAccess'.............. Failed to grant minimum permission requests. Also when installing the ODP i got the following:  The procedure entry point GetProcessImageFileNameW could not be located in the dynamic link library PSAPI.DLL Why don't you want to use the built-in OracleClient provided with Visual Web Developer? ...

simple web application created in VB.net(VS.Net) will not run
I tried to run the ASP.net samples created by VB.net. But it doesn't run successfully. For example, I copied VB project folder at C:\Inetpub\wwwroot\VB\Project. From the web browser I typed http://localhost/VB/Project/Project.aspx Only the text for some LabelControls showed up, not the content Text generated by project.aspx.vb. Does that mean that I didn't set the IIS and ASP.net correct? Can you post the source code for your application. This may make it easier to debug what is going on. Thanks. Glen Kowalski Software Design Engineer / Test Microsoft Corporation This posti...

Upgrade VB.net 2002 to VB.net 2003
Hi, i want to upgrade VB.net 2002 to VB.net 2003.what is the procedure?Uninstall 2002 and Install 2003 or something else? VB.net 2003 includes Framework 1.1 or i will install it separately?thanx in advance ...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of developing. The trick is to use the "Src" attribute of the @Page directive. Check out the link if you are inclined. You are welcome to download the code if you are interested further, found at the same link. (Note that the reason that I looked for a way to do this is because I wanted to have the option to include some VB.NET-based demos at my site. Since my site is a C#.NET ASP.NET, I was told that there was no want to do this. Therefore, I looked for a workaround and just happened to find one.) Enjoy (and then get back to work!) http://www.NetBrainer.com you are right !!!mixing languages could cause unknow and uncontrolled problems !!! if a developer has to mix ....the practical way is to create a new project with different language and what will be absolutely fine !!!thanks mkamoski for raising this issue !!Fadil Alnassar www.fadilalnassar.com | FREE Nodil Tab Controlhttp://www.mefranchisi...

what lang does everyone prefer? Thanks, Peter Iuvara, MCP It's a very famous debatable question in forums! I would say if you are from Java/C/C++, then C# would be easy to use for you. If you are from ASP/VB, then VB.NET would be easy for you! As long as if you follow CLS, then what ever the language you use, it's going to be the same for CLR!Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti I would agree with that ... just curious as to what user's on this forum predominantly code in?Thanks, Peter Iuvara, MCP I came from no real programming background, started i...

VB.Net To C#.Net
Hello... Since Last from 1 year i had develope web application in using vb.net now i want to transfer from vb.net to c#.net so what should i do to transform to c# language any link or book related to me through i can easily understand and coding using c# in a short time... Thanks~ Mark As Answer If UseFull ~Kaushal. Hi, you can read the specifications of the language. You're already familiar with .NET and how to program in an OO manner thanks to your experience with vb.net. The only thing you need to learn is the new syntax of C#. You can also convert parts of your v...

vb .net or c# .net
I currently develop websites using php but have been requested to develop a site using asp.net. The question I have is for someone who knows php would it be better to transition to vb.net or c#.net? Thanks, Fr. Robert C# -> There is a converter that will transition about 60% or more of your PHP code to C#. Plus C# is closer to PHP than VB.NET.Jason N. GaylordASPInsider and Microsoft MVPhttp://jasongaylord.com...

About VB.net And VC.net
I am always Programming With VB.net Recently My Teacher ask us to learn Vc or VC.net. I try to learn it and compare it with vb.net, I found it's much too complex than vb. However it is said vc is strongger than vb I want to know Why vc is strongger than vb? and is it hard too learn vc? I am new to asp.net Thanks for man who want to help me! Wuhan, Hubei, China Below links could give some info http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q308470Sreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti VisualC is not a language in an of itself, it's a program for writing C++. Generally there is just a perception out there that VB is a 'toy' language. Every new version of VB has made this less and less true. Now we have VB.Net which has all the power that C#, FORTRAN for .Net, or any other language targeting the Common Language Runtime has. if you're writing Managed C++, you cant do anything more than you can do in VB. Visual C lets you write mixed-mode C++. This allows access to all the fun un-managed features of C++. That said, C++/C# are significatly less tolerant of messy programming than VB. I've found that I just write better code in C# than I do in VB. C# in my opinion seems to require more accedemic rigor than VB. It is not particuarly hard to learn C# once you know VB.net. I would love to recomend a book, but i've taught myself both off of MSDN. I've heard Programing C# 3rd Ed. is good. I have P...

Bad web.config in AJAX.NET 1.0 under .NET 2.0 Express
My setup is MS.NET v2.0 with the C# and Web Express editions of 2005. I also installed the AJAX 1.0 release with the respective toolkit as indicated in the AJAX.NET site. However, when I create a new project I am presented with the usual bare bones default.aspx and the web.config. However the web.config shows a lot of warnings and errors.One of them was being that the "requiredPermission" (or something like that) attribute was not recognized. Somewhere on the net there is a post of a correction to the DotNetConfig.xsd schema file in VS.2005 so I used it and it got rid of THAT warning.&n...

Question about .cs classes in .NET Web Developer Express
Hello, I am fairly new to the C# and .NET language.  I am currently creating small programs in web developer express to learn the code and techniques.  The project I am working on now has some custom methods/objects that I had created and the script file is getting quite large.  I would like to export some of the methods/objects to a .cs class file and just call them from the script to save some room and maybe use the methods/objects with another page on the website.  I have created the .cs class file and added what I want to, but I am having trouble calling the meth...

How to call a .net web service from another .net web service?
Hi all,I have developed two asp .net web services using visual studio .net 2003.I wish to call one web service from another web service.I tried adding a web reference of the web service in another web service and was able to do so.but i m not able to access the web methods provided by the web servicecould you please suggest a way to go about itExpecting quick replyThanxCharmy try to make sure that you reference it in the web reference and call it properly this is sample  [WebMethod()] public double CalcDistance(int x1, int y1, int x2, int y2) { Calculator.Service1 calc = new...

converting vb.net 2003 files to vb.net 2005
Hi, i am beginner..i watch videos about vb.net..they made on vs.net 2003 when i wrote these codes in 2005 ,it gives errors..is there any program which convert the code automatically?   thanks,Thanks,Speranza What videos are you talking about?  There are lots of great, up-to-date ASP.NET Videos on this site for free.Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you! i am talking about learnvisualstudio.net videos..Thanks,Speranza Speranza:they made on vs.net 2003 when i wrote these codes in 2005 ,it gives errors..is there any program which convert the code automatically?  Hi Speranza, As far as I know, there is no tool can directly convert .net 1.1 code snippet to .net 2.0 version. However, if you want to convert an existing VS.NET 2003 project to VS.NET 2005 project. You can use VS.NET 2005 to open its project file (*.vbproj) or the solution file (*.sln), then Visual Studio 2005 will automatically start the Conversion Wizard to perform this conversion task. For more information about the conversion, please refer to the following link: How to: Convert a Visual Studio .NET Project to Visual Studio 2005http://msdn2.microsoft.com/en-us/library/ms247241(VS.80).aspx If you want to use VS.NET 2005 as your development tool, watch the videos for .net 2.0. In addition, besides the video resource, you can also view the Quickstart online: ASP.NET Quickstart Tutorialhttp://quickstarts.asp.net/Qui...

Web resources about - vb.net instantiate a class - asp.net.web-dev-2008-express

Experimental game [Code] instantiates love of programming
I'm walking through the firehouse in Culver City where a good portion of the games at IndieCade are set up, and then I see what looks like "not ...

Code: Flickr Developer Blog
(Flickr is hiring! Check out our open job postings and what it’s like to work at Flickr .) Web workers are awesome. They’ll change the way you ...

Plato - Wikipedia, the free encyclopedia
– 348/347 BC) was a Classical Greek philosopher , mathematician , student of Socrates , writer of philosophical dialogues, and founder of the ...

Ontology - Wikipedia, the free encyclopedia
This article concerns ontology in philosophy. For the concept in information science, see Ontology (information science) . Not to be confused ...

Cisco patches vulnerabilities in VPN client, security appliances
Networking equipment vendor Cisco Systems released multiple security updates on Wednesday to address vulnerabilities in its AnyConnect Secure ...

Impromptu is an OSX programming language and environment for composers, sound artists, VJ's and graphic artists with an interest in live or interactive ...

Dictionary of Philosophy of Mind - functionalism
functionalism(1) - The view that the physical realization of a functional component is not, in some sense, its essence. Rather, what makes a ...

Ajay Matharu on Web, Technology and Life
Ajay Matharu on ASP.Net, .Net, Javascript, PHP, SQL, CSS, Sharepoint, Web, Technology and Life

Annals of Americus - Notes on Art, Culture & Politics
... I was living in Albany, NY. My friend loaded LAYAR onto his phone and we walked around our neighborhood, watching real estate data instantiate ...

Resources last updated: 2/28/2016 4:41:07 PM